Update of /project/climacs/cvsroot/climacs In directory common-lisp.net:/tmp/cvs-serv30269
Modified Files: base-test.lisp base.lisp Log Message: Fixes to delete-indentation, tests.
Date: Mon Feb 7 23:13:38 2005 Author: abakic
Index: climacs/base-test.lisp diff -u climacs/base-test.lisp:1.7 climacs/base-test.lisp:1.8 --- climacs/base-test.lisp:1.7 Sun Feb 6 18:38:31 2005 +++ climacs/base-test.lisp Mon Feb 7 23:13:37 2005 @@ -900,5 +900,66 @@ (values (offset m) (buffer-sequence buffer 0 (size buffer))))) + 0 "climacs ") + +(deftest standard-buffer-delete-indentation.test-2 + (let ((buffer (make-instance 'standard-buffer))) + (insert-buffer-sequence buffer 0 " + climacs ") + (let ((m (make-instance 'standard-right-sticky-mark + :buffer buffer :offset 7))) + (delete-indentation m) + (values + (offset m) + (buffer-sequence buffer 0 (size buffer))))) + 0 "climacs ") + +(deftest standard-buffer-delete-indentation.test-3 + (let ((buffer (make-instance 'standard-buffer))) + (insert-buffer-sequence buffer 0 " climacs ") + (let ((m (make-instance 'standard-left-sticky-mark + :buffer buffer :offset 7))) + (delete-indentation m) + (values + (offset m) + (buffer-sequence buffer 0 (size buffer))))) + 0 " climacs ") + +(deftest standard-buffer-delete-indentation.test-4 + (let ((buffer (make-instance 'standard-buffer))) + (insert-buffer-sequence buffer 0 "climacs + climacs ") + (let ((m (make-instance 'standard-right-sticky-mark + :buffer buffer :offset 12))) + (delete-indentation m) + (values + (offset m) + (buffer-sequence buffer 0 (size buffer))))) + 8 "climacs climacs ") + +(deftest standard-buffer-delete-indentation.test-5 + (let ((buffer (make-instance 'standard-buffer))) + (insert-buffer-sequence buffer 0 " + + climacs ") + (let ((m (make-instance 'standard-right-sticky-mark + :buffer buffer :offset 12))) + (delete-indentation m) + (values + (offset m) + (buffer-sequence buffer 0 (size buffer))))) 1 " - climacs ") +climacs ") + +(deftest standard-buffer-fill-line.test-1 + (let ((buffer (make-instance 'standard-buffer))) + (insert-buffer-sequence buffer 0 "climacs climacs climacs") + (let ((m (make-instance 'standard-right-sticky-mark + :buffer buffer :offset 25))) + (fill-line m #'(lambda (m) (declare (ignore m)) 8) 10 8) + (values + (offset m) + (buffer-sequence buffer 0 (size buffer))))) + 27 "climacs + climacs + climacs")
Index: climacs/base.lisp diff -u climacs/base.lisp:1.33 climacs/base.lisp:1.34 --- climacs/base.lisp:1.33 Sun Feb 6 17:33:50 2005 +++ climacs/base.lisp Mon Feb 7 23:13:37 2005 @@ -475,13 +475,16 @@ (defun delete-indentation (mark) (beginning-of-line mark) (unless (beginning-of-buffer-p mark) + (delete-range mark -1) (loop until (end-of-buffer-p mark) while (whitespacep (object-after mark)) do (delete-range mark 1)) (loop until (beginning-of-buffer-p mark) while (whitespacep (object-before mark)) do (delete-range mark -1)) - (insert-object mark #\Space))) + (when (and (not (beginning-of-buffer-p mark)) + (constituentp (object-before mark))) + (insert-object mark #\Space))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; @@ -505,7 +508,7 @@ (t (incf column))) (when (and (>= column fill-column) - (/= (offset begin-mark) line-beginning-offset)) + (/= (offset begin-mark) line-beginning-offset)) (insert-object begin-mark #\Newline) (incf (offset begin-mark)) (let ((indentation