Changeset 11971


Ignore:
Timestamp:
Apr 27, 2009, 5:54:44 AM (10 years ago)
Author:
gb
Message:

HEMLOCK-EXT:SCROLL-VIEW: accept HOW arguments (:VIEW-PAGE-UP/DOWN) that
don't modify the selection.

New "Page Up", "Page Down" commands.

Bind #k"pageup" to "Page Up", #k"pagedown" to "Page Down" commands.

(ticket:195).

Location:
trunk/source/cocoa-ide
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/cocoa-ide/cocoa-editor.lisp

    r11967 r11971  
    27722772(defmethod hemlock-ext:scroll-view ((view hi:hemlock-view) how &optional where)
    27732773  (assume-cocoa-thread)
    2774   (let* ((tv (text-pane-text-view (hi::hemlock-view-pane view))))
     2774  (let* ((tv (text-pane-text-view (hi::hemlock-view-pane view)))
     2775         (may-change-selection t))
    27752776    (when (eq how :line)
    27762777      (setq where (require-type where '(integer 0)))
     
    27822783      (:center-selection
    27832784       (#/centerSelectionInVisibleArea: tv +null-ptr+))
    2784       (:page-up
     2785      ((:page-up :view-page-up)
     2786       (when (eq how :view-page-up)
     2787         (setq may-change-selection nil))
    27852788       (require-type where 'null)
    27862789       ;; TODO: next-screen-context-lines
    27872790       (scroll-by-lines tv (- *next-screen-context-lines* (view-screen-lines view))))
    2788       (:page-down
     2791      ((:page-down :view-page-down)
     2792       (when (eq how :view-page-down)
     2793         (setq may-change-selection nil))
    27892794       (require-type where 'null)
    27902795       (scroll-by-lines tv (- (view-screen-lines view) *next-screen-context-lines*)))
     
    27942799       (scroll-by-lines tv (require-type where 'integer))))
    27952800    ;; If point is not on screen, move it.
    2796     (let* ((point (hi::current-point))
    2797            (point-pos (hi::mark-absolute-position point)))
    2798       (multiple-value-bind (win-pos win-len) (visible-charpos-range tv)
    2799         (unless (and (<= win-pos point-pos) (< point-pos (+ win-pos win-len)))
    2800           (let* ((point (hi::current-point-collapsing-selection))
    2801                  (cache (hemlock-buffer-string-cache (#/hemlockString (#/textStorage tv)))))
    2802             (move-hemlock-mark-to-absolute-position point cache win-pos)
    2803             (update-hemlock-selection (#/textStorage tv))))))))
     2801    (when may-change-selection
     2802      (let* ((point (hi::current-point))
     2803             (point-pos (hi::mark-absolute-position point)))
     2804        (multiple-value-bind (win-pos win-len) (visible-charpos-range tv)
     2805          (unless (and (<= win-pos point-pos) (< point-pos (+ win-pos win-len)))
     2806            (let* ((point (hi::current-point-collapsing-selection))
     2807                   (cache (hemlock-buffer-string-cache (#/hemlockString (#/textStorage tv)))))
     2808              (move-hemlock-mark-to-absolute-position point cache win-pos)
     2809              (update-hemlock-selection (#/textStorage tv)))))))))
    28042810
    28052811(defun iana-charset-name-of-nsstringencoding (ns)
  • trunk/source/cocoa-ide/hemlock/src/bindings.lisp

    r11890 r11971  
    7272(bind-key "Universal Argument" #k"control-u")
    7373(bind-key "Scroll Window Down" #k"control-v")
    74 (bind-key "Scroll Window Down" #k"pagedown")
     74(bind-key "Page Down" #k"pagedown")
    7575(bind-key "Scroll Window Up" #k"meta-v")
    76 (bind-key "Scroll Window Up" #k"pageup")
     76(bind-key "Page Up" #k"pageup")
    7777;(bind-key "Scroll Next Window Down" #k"control-meta-v")
    7878;(bind-key "Scroll Next Window Up" #k"control-meta-V")
  • trunk/source/cocoa-ide/hemlock/src/command.lisp

    r8428 r11971  
    390390    (set-scroll-position :page-down)))
    391391
     392(defcommand "Page Down" (p)
     393  "Move down one screenfull, without changing the selection."
     394  "Ignores prefix argument"
     395  (declare (ignore p))
     396  (set-scroll-position :view-page-down))
     397
    392398(defcommand "Scroll Window Up" (p)
    393399  "Move up one screenfull.
     
    399405    (set-scroll-position :lines-up p)
    400406    (set-scroll-position :page-up)))
     407
     408(defcommand "Page Up" (p)
     409  "Move up one screenfull, without changing the selection."
     410  "Ignores prefix argument."
     411  (declare (ignore p))
     412  (set-scroll-position :view-page-up))
    401413
    402414;;;; Kind of miscellaneous commands:
Note: See TracChangeset for help on using the changeset viewer.