[mcclim-cvs] CVS mcclim/Drei

thenriksen thenriksen at common-lisp.net
Thu Nov 30 17:00:09 UTC 2006


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

Modified Files:
	motion.lisp 
Log Message:
Improved the page and paragraph motion methods.

Basically, my philosophy is that all the unit methods must behave
similarly wrt. where they move to within the seperator
whitespace. This will mean that the Climacs paragraph motion commands
are not identical to those of Emacs, but I believe the consistency is
worth this.


--- /project/mcclim/cvsroot/mcclim/Drei/motion.lisp	2006/11/18 22:02:41	1.2
+++ /project/mcclim/cvsroot/mcclim/Drei/motion.lisp	2006/11/30 17:00:09	1.3
@@ -351,8 +351,13 @@
 reached."))
 
 (defmethod forward-one-page (mark syntax)
-  (when (search-forward mark (coerce (page-delimiter syntax) 'vector))
-      t))
+  (unless (end-of-buffer-p mark)
+    (forward-object mark 1)
+    (if (search-forward mark (coerce (page-delimiter syntax) 'vector))
+        (progn (backward-object mark (length (page-delimiter syntax)))
+               t)
+        (progn (end-of-buffer mark)
+               nil))))
 
 (defgeneric backward-one-page (mark syntax)
   (:documentation
@@ -361,9 +366,13 @@
 reached."))
 
 (defmethod backward-one-page (mark syntax)
-  (when (search-backward mark (coerce (page-delimiter syntax) 'vector))
-    (forward-object mark)
-    t))
+  (unless (beginning-of-buffer-p mark)
+    (backward-object mark 1)
+    (if (search-backward mark (coerce (page-delimiter syntax) 'vector))
+        (progn (forward-object mark (length (page-delimiter syntax)))
+               t)
+        (progn (beginning-of-buffer mark)
+               nil))))
 
 (define-motion-fns page)
 
@@ -464,9 +473,13 @@
 Return T if successful, or NIL if the buffer limit was reached."))
 
 (defmethod backward-one-paragraph (mark syntax)
-  (when (search-backward mark (coerce (paragraph-delimiter syntax) 'vector))
-    (forward-object mark)
-    t))
+  (unless (beginning-of-buffer-p mark)
+    (backward-object mark 1)
+    (if (search-backward mark (coerce (paragraph-delimiter syntax) 'vector))
+        (progn (forward-object mark (length (paragraph-delimiter syntax)))
+               t)
+        (progn (beginning-of-buffer mark)
+               nil))))
 
 (defgeneric forward-one-paragraph (mark syntax)
   (:documentation
@@ -474,9 +487,13 @@
 Return T if successful, or NIL if the buffer limit was reached."))
 
 (defmethod forward-one-paragraph (mark syntax)
-  (when (search-forward mark (coerce (paragraph-delimiter syntax) 'vector))
-    (backward-object mark)
-    t))
+  (unless (end-of-buffer-p mark)
+    (forward-object mark 1)
+    (if (search-forward mark (coerce (paragraph-delimiter syntax) 'vector))
+        (progn (backward-object mark (length (paragraph-delimiter syntax)))
+               t)
+        (progn (end-of-buffer mark)
+               nil))))
 
 (define-motion-fns paragraph)
 




More information about the Mcclim-cvs mailing list