diff --git a/editor/editor.lisp b/editor/editor.lisp index 30fc036..4801c16 100644 --- a/editor/editor.lisp +++ b/editor/editor.lisp @@ -406,11 +406,19 @@ serial connection the editor normally runs under.") (cursor-column (cursor *editor*)) start) (update-buffer-cursor (current-buffer *editor*)))))) -(defmethod redisplay-line ((line line) &key (start 0) addingp) +(defmethod redisplay-line ((line line) &key (start 0) addingp known-free-p) ;; TODO: save the cursor position - (with-editor-accessors *editor* (:current-line current - :current-buffer buffer) + (with-editor-accessors *editor* (:current-buffer buffer) (cond + (known-free-p + (let ((start (position-if-not (lambda (c) (char= c #\Space)) + (line-content line)))) + (when start + (hide-cursor) + (move-cursor (view-line-number (buffer-view buffer) line) + start) + (write-string (line-content line) *eio* :start start) + (show-cursor)))) ((and addingp (= start (1- (line-length line)))) (let ((char-pos (1- (fill-pointer (line-content line))))) (move-cursor (view-line-number (buffer-view buffer) line) char-pos) @@ -601,7 +609,7 @@ Additionally ensures correct line numbers on the way, as a bonus." (prev-line (top-line view)) (bottom-line view) (prev-line (bottom-line view))) - (redisplay-line (top-line view)) + (redisplay-line (top-line view) :known-free-p t) (redisplay-status-line :completely-p nil)) (defmethod get-line-into-view ((line line) (view buffer-view))