Optimize editor newline command
This may be the wrong place for this optimization, but I don't have the luxury of having time to do things right. Hell, the editor is all in one big file, does it look like I have time to spare for quality?
This commit is contained in:
parent
2157589190
commit
78487f1c24
1 changed files with 16 additions and 5 deletions
|
@ -592,11 +592,22 @@ Additionally ensures correct line numbers on the way, as a bonus."
|
||||||
(defun com-newline ()
|
(defun com-newline ()
|
||||||
(with-editor-accessors *editor* (:current-column column
|
(with-editor-accessors *editor* (:current-column column
|
||||||
:current-line line)
|
:current-line line)
|
||||||
(ensure-correct-line-number (new-line-at line column))
|
(let* ((old-line line)
|
||||||
(redisplay-view-from-line (current-view *editor*) line)
|
(new-line (new-line-at line column))
|
||||||
(com-next-line)
|
(in-view-p (line-in-view new-line (current-view *editor*))))
|
||||||
(com-beginning-of-line)
|
(ensure-correct-line-number new-line)
|
||||||
(redisplay-line line)))
|
(com-next-line)
|
||||||
|
(com-beginning-of-line)
|
||||||
|
(when in-view-p
|
||||||
|
(set-scrolling-region (view-line-number (current-view *editor*)
|
||||||
|
new-line)
|
||||||
|
(1- *status-line-position*))
|
||||||
|
(scroll-screen-down)
|
||||||
|
(set-scrolling-region))
|
||||||
|
(when (line-in-view old-line (current-view *editor*))
|
||||||
|
(redisplay-line old-line :start column))
|
||||||
|
(when in-view-p
|
||||||
|
(redisplay-line new-line)))))
|
||||||
|
|
||||||
(defun com-beginning-of-line ()
|
(defun com-beginning-of-line ()
|
||||||
(with-editor-accessors *editor* (:current-column column
|
(with-editor-accessors *editor* (:current-column column
|
||||||
|
|
Loading…
Add table
Reference in a new issue