Update of /project/climacs/cvsroot/climacs In directory common-lisp.net:/tmp/cvs-serv9690
Modified Files: buffer-test.lisp buffer.lisp Log Message: Changed region-to-sequence to be symmetrical wrt. marks.
Date: Sat Feb 5 14:49:21 2005 Author: abakic
Index: climacs/buffer-test.lisp diff -u climacs/buffer-test.lisp:1.10 climacs/buffer-test.lisp:1.11 --- climacs/buffer-test.lisp:1.10 Fri Jan 28 19:47:29 2005 +++ climacs/buffer-test.lisp Sat Feb 5 14:49:20 2005 @@ -710,6 +710,14 @@ (and (not (eq seq seq2)) seq2))) "climacs")
+(deftest standard-buffer-region-to-sequence.test-1aa + (let ((seq "climacs") + (buffer (make-instance 'standard-buffer))) + (insert-buffer-sequence buffer 0 seq) + (let ((seq2 (region-to-sequence (high-mark buffer) 0))) + (and (not (eq seq seq2)) seq2))) + "climacs") + (deftest standard-buffer-region-to-sequence.test-1b (let ((seq "climacs") (buffer (make-instance 'standard-buffer))) @@ -718,12 +726,20 @@ (and (not (eq seq seq2)) seq2))) "climacs")
+(deftest standard-buffer-region-to-sequence.test-1ba + (let ((seq "climacs") + (buffer (make-instance 'standard-buffer))) + (insert-buffer-sequence buffer 0 seq) + (let ((seq2 (region-to-sequence 7 (low-mark buffer)))) + (and (not (eq seq seq2)) seq2))) + "climacs") + (deftest standard-buffer-region-to-sequence.test-2 (let ((seq "climacs") (buffer (make-instance 'standard-buffer))) (insert-buffer-sequence buffer 0 seq) (region-to-sequence (high-mark buffer) (low-mark buffer))) - #()) + "climacs")
(deftest standard-buffer-region-to-sequence.test-3 (handler-case @@ -847,4 +863,4 @@ for i from 0 below 100000 do (insert-buffer-sequence b (floor (size b) 2) "abcdefghij") finally (return (size b))) - 1000000) \ No newline at end of file + 1000000)
Index: climacs/buffer.lisp diff -u climacs/buffer.lisp:1.25 climacs/buffer.lisp:1.26 --- climacs/buffer.lisp:1.25 Sat Feb 5 08:04:03 2005 +++ climacs/buffer.lisp Sat Feb 5 14:49:20 2005 @@ -488,13 +488,23 @@
(defmethod region-to-sequence ((mark1 mark-mixin) (mark2 mark-mixin)) (assert (eq (buffer mark1) (buffer mark2))) - (buffer-sequence (buffer mark1) (offset mark1) (offset mark2))) + (let ((offset1 (offset mark1)) + (offset2 (offset mark2))) + (when (> offset1 offset2) + (rotatef offset1 offset2)) + (buffer-sequence (buffer mark1) offset1 offset2)))
-(defmethod region-to-sequence ((offset integer) (mark mark-mixin)) - (buffer-sequence (buffer mark) offset (offset mark))) +(defmethod region-to-sequence ((offset1 integer) (mark2 mark-mixin)) + (let ((offset2 (offset mark2))) + (when (> offset1 offset2) + (rotatef offset1 offset2)) + (buffer-sequence (buffer mark2) offset1 offset2)))
-(defmethod region-to-sequence ((mark mark-mixin) (offset integer)) - (buffer-sequence (buffer mark) (offset mark) offset)) +(defmethod region-to-sequence ((mark1 mark-mixin) (offset2 integer)) + (let ((offset1 (offset mark1))) + (when (> offset1 offset2) + (rotatef offset1 offset2)) + (buffer-sequence (buffer mark1) offset1 offset2)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;