(in-package :editor) (defun linewise () b-vim-linewise) (defun exclusive () b-vim-exclusive) (defun inclusive () (not b-vim-exclusive)) (defun (setf linewise) (val) (setf b-vim-linewise val)) (defun (setf exclusive) (val) (setf b-vim-exclusive val)) (defun (setf inclusive) (val) (setf b-vim-exclusive (not val))) (defun just-blanks (start end) "Returns T if the characters from start to end are spaces." (loop for ch across (points-to-string start end) if (not (eql ch #\Space)) do (return nil) finally (return t))) (defun blanks-before (point) (with-point ((bol point :temporary)) (line-start bol) (just-blanks bol point))) (defun blanks-after (point) (with-point ((eol point :temporary)) (line-end eol) (just-blanks point eol))) (defun scroll-line-to-place (line-num place) (when line-num (move-point (current-point) (buffers-start (current-buffer))) ;; This seems like it could be a fairly expensive operation. Hope not. (line-offset (current-point) (1- line-num))) (with-point ((point (current-point))) (setf point (ecase place (:top point) (:middle (line-offset point (- (floor (window-height (current-window)) 2)))) (:bottom (line-offset point (- 1 (window-height (current-window))))))) (if point (line-start point) (setf point (buffers-start (current-buffer)))) (when point (move-point (window-display-start (current-window)) point))))