Changeset 12285


Ignore:
Timestamp:
Jun 24, 2009, 4:07:39 PM (10 years ago)
Author:
mikel
Message:

collapse-if-selection was modifying point in a way that confused subsequent movement commands; that is now fixed.

Location:
trunk/source/cocoa-ide/hemlock/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/cocoa-ide/hemlock/src/command.lisp

    r12281 r12285  
    2727          t))
    2828      nil))
     29
     30(defun collapse-if-selection (&key (direction :forward))
     31  (assert (memq direction '(:backward :forward))()
     32          "collapse-if-selection requires a :direction argument equal to either :backward or :forward")
     33  (let ((b (current-buffer)))
     34    (if (hi::%buffer-current-region-p b)
     35        (let* ((point (buffer-point b))
     36               (region (current-region)))
     37          ;; Deactivate the region
     38          (ecase direction
     39            ((:backward) (move-mark point (region-start region)))
     40            ((:forward) (move-mark point (region-end region))))
     41          (setf (hi::buffer-region-active b) nil)
     42          point)
     43        nil)))
     44
    2945
    3046;;; Make a mark for buffers as they're consed:
  • trunk/source/cocoa-ide/hemlock/src/indent.lisp

    r12145 r12285  
    192192
    193193(defcommand "New Line" (p)
    194   "Moves the point to a new blank line.
     194    "Moves the point to a new blank line.
    195195  A newline is inserted.
    196196  With an argument, repeats p times."
    197   "Moves the point to a new blank line."
     197    "Moves the point to a new blank line."
    198198  (let ((point (current-point-for-insertion))
    199         (count (if p p 1)))
     199        (count (if p p 1)))
    200200    (if (not (minusp count))
    201       (dotimes (i count) (insert-character point #\newline))
    202       (editor-error))))
     201        (dotimes (i count) (insert-character point #\newline))
     202        (editor-error))))
    203203
    204204
Note: See TracChangeset for help on using the changeset viewer.