diff options
| author | Daniel Colascione | 2025-03-07 16:22:56 -0800 |
|---|---|---|
| committer | Daniel Colascione | 2025-03-07 16:27:37 -0800 |
| commit | 062c6ab3dd5a1ce85fb7cb0fc84b65aa2cf60369 (patch) | |
| tree | 634f35f5e83bab59650b4123a3b3cc7d2cea8fa4 | |
| parent | a48659e57c8f89c3182274c9faac87ff17e0ab64 (diff) | |
| download | emacs-062c6ab3dd5a1ce85fb7cb0fc84b65aa2cf60369.tar.gz emacs-062c6ab3dd5a1ce85fb7cb0fc84b65aa2cf60369.zip | |
Stop term-erase-in-line disturbing markers
* lisp/term.el (term-erase-in-line): do nothing if there's nothing to
do; insert new newlines before deleting old ones.
| -rw-r--r-- | lisp/term.el | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/lisp/term.el b/lisp/term.el index 25f90045925..8d57f949615 100644 --- a/lisp/term.el +++ b/lisp/term.el | |||
| @@ -4050,19 +4050,24 @@ all pending output has been dealt with.")) | |||
| 4050 | (wrapped (and (zerop (term-horizontal-column)) | 4050 | (wrapped (and (zerop (term-horizontal-column)) |
| 4051 | (not (zerop (term-current-column)))))) | 4051 | (not (zerop (term-current-column)))))) |
| 4052 | (term-vertical-motion 1) | 4052 | (term-vertical-motion 1) |
| 4053 | (delete-region saved-point (point)) | 4053 | ;; Do nothing if we have nothing to delete |
| 4054 | ;; wrapped is true if we're at the beginning of screen line, | 4054 | (unless (and (eq saved-point (1- (point))) |
| 4055 | ;; but not a buffer line. If we delete the current screen line | 4055 | (eq (char-before) ?\n) |
| 4056 | ;; that will make the previous line no longer wrap, and (because | 4056 | (not wrapped)) |
| 4057 | ;; of the way Emacs display works) point will be at the end of | 4057 | ;; Insert before deletion to preserve markers. |
| 4058 | ;; the previous screen line rather then the beginning of the | 4058 | ;; wrapped is true if we're at the beginning of screen line, |
| 4059 | ;; current one. To avoid that, we make sure that current line | 4059 | ;; but not a buffer line. If we delete the current screen line |
| 4060 | ;; contain a space, to force the previous line to continue to wrap. | 4060 | ;; that will make the previous line no longer wrap, and (because |
| 4061 | ;; We could do this always, but it seems preferable to not add the | 4061 | ;; of the way Emacs display works) point will be at the end of |
| 4062 | ;; extra space when wrapped is false. | 4062 | ;; the previous screen line rather then the beginning of the |
| 4063 | (when wrapped | 4063 | ;; current one. To avoid that, we make sure that current line |
| 4064 | (insert ? )) | 4064 | ;; contain a space, to force the previous line to continue to wrap. |
| 4065 | (insert ?\n) | 4065 | ;; We could do this always, but it seems preferable to not add the |
| 4066 | ;; extra space when wrapped is false. | ||
| 4067 | (when wrapped | ||
| 4068 | (insert-before-markers ? )) | ||
| 4069 | (insert-before-markers ?\n) | ||
| 4070 | (delete-region saved-point (point))) | ||
| 4066 | (put-text-property saved-point (point) 'font-lock-face 'default) | 4071 | (put-text-property saved-point (point) 'font-lock-face 'default) |
| 4067 | (goto-char saved-point)))) | 4072 | (goto-char saved-point)))) |
| 4068 | 4073 | ||