[mcclim-cvs] CVS mcclim/Drei

thenriksen thenriksen at common-lisp.net
Wed Nov 29 09:59:01 UTC 2006


Update of /project/mcclim/cvsroot/mcclim/Drei
In directory clnet:/tmp/cvs-serv19881

Modified Files:
	editing.lisp 
Log Message:
We also need different line-transposition methods for left- and
right-sticky-marks.


--- /project/mcclim/cvsroot/mcclim/Drei/editing.lisp	2006/11/29 09:39:57	1.3
+++ /project/mcclim/cvsroot/mcclim/Drei/editing.lisp	2006/11/29 09:59:00	1.4
@@ -299,7 +299,7 @@
 
 ;; Autogenerated TRANSPOSE-LINES is not good enough.
 (defmethod transpose-lines
-    (mark syntax)
+    ((mark left-sticky-mark) syntax)
   (beginning-of-line mark)
   (unless (beginning-of-buffer-p mark)
     (backward-line mark syntax))
@@ -312,11 +312,28 @@
     (unless (end-of-buffer-p mark)
       (delete-range mark))
     (end-of-line mark)
-    (insert-object mark #\Newline)
     (forward-line mark syntax 0)
     (insert-sequence mark line)
     (insert-object mark #\Newline)))
 
+(defmethod transpose-lines
+    ((mark right-sticky-mark) syntax)
+  (beginning-of-line mark)
+  (unless (beginning-of-buffer-p mark)
+    (backward-line mark syntax))
+  (let* ((bol (offset mark))
+	 (eol (progn (end-of-line mark)
+		     (offset mark)))
+	 (line (buffer-sequence (buffer mark) bol eol)))
+    (delete-region bol mark)
+    ;; Remove newline at end of line as well.
+    (unless (end-of-buffer-p mark)
+      (delete-range mark))
+    (end-of-line mark)
+    (insert-object mark #\Newline)
+    (forward-line mark syntax 0)
+    (insert-sequence mark line)))
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; 
 ;;; Word editing




More information about the Mcclim-cvs mailing list