Skip to content

Commit 2681120

Browse files
committed
close #529 #496 fix Laggy scrolling in terminal programs.
1 parent a4588b7 commit 2681120

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

vterm.el

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -893,7 +893,7 @@ will invert `vterm-copy-exclude-prompt' for that call."
893893
(when-let ((key (key-description (vector raw-key))))
894894
(vterm-send-key key shift meta ctrl))))))
895895

896-
(defun vterm-send-key (key &optional shift meta ctrl)
896+
(defun vterm-send-key (key &optional shift meta ctrl accept-proc-output)
897897
"Send KEY to libvterm with optional modifiers SHIFT, META and CTRL."
898898
(deactivate-mark)
899899
(when vterm--term
@@ -903,7 +903,8 @@ will invert `vterm-copy-exclude-prompt' for that call."
903903
(setq key (upcase key)))
904904
(vterm--update vterm--term key shift meta ctrl)
905905
(setq vterm--redraw-immididately t)
906-
(accept-process-output vterm--process vterm-timer-delay nil t))))
906+
(when accept-proc-output
907+
(accept-process-output vterm--process vterm-timer-delay nil t)))))
907908

908909
(defun vterm-send (key)
909910
"Send KEY to libvterm. KEY can be anything `kbd' understands."
@@ -1098,7 +1099,7 @@ Provide similar behavior as `insert' for vterm."
10981099
(when vterm--term
10991100
(if (vterm-goto-char start)
11001101
(cl-loop repeat (- end start) do
1101-
(vterm-send-delete))
1102+
(vterm-send-key "<delete>" nil nil nil t))
11021103
(let ((inhibit-read-only nil))
11031104
(vterm--delete-region start end)))))
11041105

@@ -1117,13 +1118,13 @@ It will reset to original position if it can't move there."
11171118
(setq cursor-pos (point))
11181119
(setq pt cursor-pos)
11191120
(while (and (> pos pt) moved)
1120-
(vterm-send-right)
1121+
(vterm-send-key "<right>" nil nil nil t)
11211122
(setq moved (not (= pt (point))))
11221123
(setq pt (point)))
11231124
(setq pt (point))
11241125
(setq moved t)
11251126
(while (and (< pos pt) moved)
1126-
(vterm-send-left)
1127+
(vterm-send-key "<left>" nil nil nil t)
11271128
(setq moved (not (= pt (point))))
11281129
(setq pt (point)))
11291130
(setq succ (= pos (point)))

0 commit comments

Comments
 (0)