aboutsummaryrefslogtreecommitdiff
path: root/vterm.el
diff options
context:
space:
mode:
authorjixiuf <jixiuf@qq.com>2021-09-08 14:40:05 +0800
committerjixiuf <jixiuf@qq.com>2021-09-08 14:40:59 +0800
commit2681120b770573044832ba8c22ccbac192e1a294 (patch)
tree668de712e4dd139e22bcab8bc1e6805a1d228c21 /vterm.el
parenta4588b72d509a63cdd9eb5086c3b6c2a873a986a (diff)
close #529 #496 fix Laggy scrolling in terminal programs.
Diffstat (limited to 'vterm.el')
-rw-r--r--vterm.el11
1 files changed, 6 insertions, 5 deletions
diff --git a/vterm.el b/vterm.el
index 59a8c90..e57de45 100644
--- a/vterm.el
+++ b/vterm.el
@@ -893,7 +893,7 @@ will invert `vterm-copy-exclude-prompt' for that call."
(when-let ((key (key-description (vector raw-key))))
(vterm-send-key key shift meta ctrl))))))
-(defun vterm-send-key (key &optional shift meta ctrl)
+(defun vterm-send-key (key &optional shift meta ctrl accept-proc-output)
"Send KEY to libvterm with optional modifiers SHIFT, META and CTRL."
(deactivate-mark)
(when vterm--term
@@ -903,7 +903,8 @@ will invert `vterm-copy-exclude-prompt' for that call."
(setq key (upcase key)))
(vterm--update vterm--term key shift meta ctrl)
(setq vterm--redraw-immididately t)
- (accept-process-output vterm--process vterm-timer-delay nil t))))
+ (when accept-proc-output
+ (accept-process-output vterm--process vterm-timer-delay nil t)))))
(defun vterm-send (key)
"Send KEY to libvterm. KEY can be anything `kbd' understands."
@@ -1098,7 +1099,7 @@ Provide similar behavior as `insert' for vterm."
(when vterm--term
(if (vterm-goto-char start)
(cl-loop repeat (- end start) do
- (vterm-send-delete))
+ (vterm-send-key "<delete>" nil nil nil t))
(let ((inhibit-read-only nil))
(vterm--delete-region start end)))))
@@ -1117,13 +1118,13 @@ It will reset to original position if it can't move there."
(setq cursor-pos (point))
(setq pt cursor-pos)
(while (and (> pos pt) moved)
- (vterm-send-right)
+ (vterm-send-key "<right>" nil nil nil t)
(setq moved (not (= pt (point))))
(setq pt (point)))
(setq pt (point))
(setq moved t)
(while (and (< pos pt) moved)
- (vterm-send-left)
+ (vterm-send-key "<left>" nil nil nil t)
(setq moved (not (= pt (point))))
(setq pt (point)))
(setq succ (= pos (point)))