[Openmcl-cvs-notifications] r12285 - in /trunk/source/cocoa-ide/hemlock/src: command.lisp indent.lisp

mikel at clozure.com mikel at clozure.com
Wed Jun 24 12:07:39 EDT 2009


Author: mikel
Date: Wed Jun 24 12:07:39 2009
New Revision: 12285

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

Modified:
    trunk/source/cocoa-ide/hemlock/src/command.lisp
    trunk/source/cocoa-ide/hemlock/src/indent.lisp

Modified: trunk/source/cocoa-ide/hemlock/src/command.lisp
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/source/cocoa-ide/hemlock/src/command.lisp (original)
+++ trunk/source/cocoa-ide/hemlock/src/command.lisp Wed Jun 24 12:07:39 2009
@@ -26,6 +26,22 @@
           (setf (hi::buffer-region-active hi::*current-buffer*) nil)
           t))
       nil))
+
+(defun collapse-if-selection (&key (direction :forward))
+  (assert (memq direction '(:backward :forward))()
+          "collapse-if-selection requires a :direction argument equal to e=
ither :backward or :forward")
+  (let ((b (current-buffer)))
+    (if (hi::%buffer-current-region-p b)
+        (let* ((point (buffer-point b))
+               (region (current-region)))
+          ;; Deactivate the region
+          (ecase direction
+            ((:backward) (move-mark point (region-start region)))
+            ((:forward) (move-mark point (region-end region))))
+          (setf (hi::buffer-region-active b) nil)
+          point)
+        nil)))
+
 =

 ;;; Make a mark for buffers as they're consed:
 =


Modified: trunk/source/cocoa-ide/hemlock/src/indent.lisp
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/source/cocoa-ide/hemlock/src/indent.lisp (original)
+++ trunk/source/cocoa-ide/hemlock/src/indent.lisp Wed Jun 24 12:07:39 2009
@@ -191,15 +191,15 @@
 =

 =

 (defcommand "New Line" (p)
-  "Moves the point to a new blank line.
+    "Moves the point to a new blank line.
   A newline is inserted.
   With an argument, repeats p times."
-  "Moves the point to a new blank line."
+    "Moves the point to a new blank line."
   (let ((point (current-point-for-insertion))
-	(count (if p p 1)))
+        (count (if p p 1)))
     (if (not (minusp count))
-      (dotimes (i count) (insert-character point #\newline))
-      (editor-error))))
+        (dotimes (i count) (insert-character point #\newline))
+        (editor-error))))
 =

 =

 =




More information about the Openmcl-cvs-notifications mailing list