[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/coterm db17a99 62/80: Describe terminal emulation
From: |
ELPA Syncer |
Subject: |
[elpa] externals/coterm db17a99 62/80: Describe terminal emulation |
Date: |
Wed, 13 Oct 2021 18:57:37 -0400 (EDT) |
branch: externals/coterm
commit db17a99f2a4393e2a836102259b024732609d285
Author: m <>
Commit: m <>
Describe terminal emulation
---
coterm.el | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/coterm.el b/coterm.el
index 2edd904..340548b 100644
--- a/coterm.el
+++ b/coterm.el
@@ -61,6 +61,15 @@
;; ;; Optional: bind `coterm-char-mode-cycle' to C-; in comint
;; (with-eval-after-load 'comint
;; (define-key comint-mode-map (kbd "C-;") #'coterm-char-mode-cycle))
+;;
+;;
+;; Differences from M-x term:
+;;
+;; coterm is written as an upgrade to comint. For existing comint users, the
+;; behaviour of comint doesn't change with coterm enabled comint except for the
+;; added functionality that we can now use TUI programs. It is therefor good
+;; for users who generally prefer comint to term.el but sometimes miss the
+;; superior terminal emulation that term.el provides.
(require 'term)
(eval-when-compile
@@ -438,6 +447,32 @@ is the process mark."
;;; Terminal emulation
+;; This is essentially a re-implementation of term.el's terminal emulation. I
+;; could have simply reused functions from term.el but that would have been
+;; unsatisfactory in my opinion. That is mostly due to the fact that term.el's
+;; terminal emulation inserts a lot of redundant trailing whitespace end empty
+;; lines, which I believe is very distracting for ordinary comint usage.
+;;
+;; Terminal emulation is coordinate based, for example, "move cursor to row 11
+;; and column 21". A coordinate position may not be reachable in an Emacs
+;; buffer because the specified line is currently too short or there aren't
+;; enough lines in the buffer. term.el automatically inserts empty lines and
+;; spaces in order to move point to a specified coordinate position. This
+;; results in trailing whitespace.
+;;
+;; coterm takes a different approach. Instead of moving point, the current
+;; terminal cursor coordinates are kept in the variables `coterm--t-row' and
+;; `coterm--t-col'. Moving the terminal cursor simply means adjusting these
+;; two variables, no whitespace needs to be inserted. Point and process mark
+;; are usually not guaranteed to be anywhere near the current coordinate
+;; position and are only restored at the end of the main filter function
+;; `coterm--t-emulate-terminal'. Only when terminal emulation requires
+;; insertion of actual text do we have to be able to reach the current cursor
+;; coordinates. We may have to insert newlines and spaces to make this
+;; position reachable, but inserting text after this whitespace means that it
+;; isn't trailing or redundant (except if the inserted text consists of only
+;; whitespace).
+
(defconst coterm--t-control-seq-regexp
;; Differences from `term-control-seq-regexp':
;;
- [elpa] externals/coterm 8b2836e 28/80: Fix incorrect handling of incomplete escape sequences, (continued)
- [elpa] externals/coterm 8b2836e 28/80: Fix incorrect handling of incomplete escape sequences, ELPA Syncer, 2021/10/13
- [elpa] externals/coterm 1ec97d2 29/80: \n doesn't go to column 0, ELPA Syncer, 2021/10/13
- [elpa] externals/coterm 9184a46 34/80: Always synchronize pmark at the end, ELPA Syncer, 2021/10/13
- [elpa] externals/coterm e64027a 43/80: Restore 'window-point' of non-selected windows, ELPA Syncer, 2021/10/13
- [elpa] externals/coterm 8f0a13b 44/80: Refactor scroll snapping, snap in all windows, ELPA Syncer, 2021/10/13
- [elpa] externals/coterm dc5f8db 38/80: Improve doc string, add autoload cookie, ELPA Syncer, 2021/10/13
- [elpa] externals/coterm ee37b4b 39/80: Initial support for char-mode and scroll snapping, ELPA Syncer, 2021/10/13
- [elpa] externals/coterm 6f42ba6 45/80: Initialize home marker properly, ELPA Syncer, 2021/10/13
- [elpa] externals/coterm 5e40af4 47/80: Prevent modification of user input harder, ELPA Syncer, 2021/10/13
- [elpa] externals/coterm dc9466e 57/80: Implement \t (move cursor to tab stop), needed for "emacs -nw", ELPA Syncer, 2021/10/13
- [elpa] externals/coterm db17a99 62/80: Describe terminal emulation,
ELPA Syncer <=
- [elpa] externals/coterm c52f413 67/80: Keep char mode in less after pressing a digit, ELPA Syncer, 2021/10/13
- [elpa] externals/coterm c717c84 75/80: Bind inhibit-read-only to t for terminal emulation, ELPA Syncer, 2021/10/13
- [elpa] externals/coterm 570ae6d 74/80: Mention auto char mode as a difference from term.el, ELPA Syncer, 2021/10/13
- [elpa] externals/coterm c825746 27/80: Fix issue with ansi-color context marker, ELPA Syncer, 2021/10/13
- [elpa] externals/coterm 73aa1f3 31/80: Properly handle OSC and Emacs specific escape sequences, ELPA Syncer, 2021/10/13
- [elpa] externals/coterm f4f69ab 32/80: Export TERMINFO environment variable, ELPA Syncer, 2021/10/13
- [elpa] externals/coterm 654e286 49/80: Fix mistake in turning mode off, ELPA Syncer, 2021/10/13
- [elpa] externals/coterm fd4041e 58/80: Remove redundant "(dirty)", ELPA Syncer, 2021/10/13
- [elpa] externals/coterm edfdbb7 50/80: Ignore sequences \e= end \e> (output by mpv), ELPA Syncer, 2021/10/13
- [elpa] externals/coterm e534194 60/80: Fix buffer-locality of saved scroll-margin, ELPA Syncer, 2021/10/13