Add eat.el-like input modes (char, emacs, mode switching)#65
Open
Add eat.el-like input modes (char, emacs, mode switching)#65
Conversation
Implement four input modes inspired by eat.el (issue #40): - Semi-char (default): most keys go to terminal, C-c prefix reserved - Char (C-c M-d): all keys sent to terminal, M-RET to exit - Copy (C-c C-t): frozen viewport for text selection (existing) - Emacs (C-c C-e): full scrollback loaded as read-only Emacs buffer Architecture changes: - Split ghostel-mode-map into base (C-c prefix) + ghostel-semi-char-mode-map (terminal bindings with parent inheritance) - Replace ghostel--copy-mode-active/ghostel--copy-mode-full-buffer with single ghostel--input-mode state variable - Extract ghostel--define-terminal-keys and ghostel--define-mouse-keys helpers to share bindings across semi-char and char keymaps - Refactor copy-mode-load-all to switch to emacs mode - Add ghostel--frozen-p / ghostel--full-scrollback-p predicates - Move clear-scrollback binding from C-c C-l to C-c M-l - C-c C-j returns to semi-char from any mode
4db55ec to
82255fe
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements four input modes inspired by eat.el, addressing #40:
C-cprefix reserved for EmacsC-c M-d): all keys sent to terminal,M-RETsole escape hatchC-c C-t): frozen viewport for text selection (existing, unchanged)C-c C-e): full scrollback loaded as read-only Emacs buffer (isearch, occur, etc.)C-c C-jreturns to semi-char from any mode. Typing a character in copy/emacs mode auto-switches to semi-char and sends the key.Architecture changes
ghostel-mode-mapinto base (C-c prefix only) +ghostel-semi-char-mode-map(terminal bindings, parent inheritance)ghostel-char-mode-map(captures everything) andghostel-emacs-mode-map(minimal, falls through to Emacs)ghostel--copy-mode-active/ghostel--copy-mode-full-bufferwith singleghostel--input-modestate variableghostel-copy-mode-load-allnow switches to emacs mode (full scrollback = emacs mode)ghostel--define-terminal-keys/ghostel--define-mouse-keyshelpers to share bindingsC-c C-ltoC-c M-l(reservingC-c C-lfor future line mode)Line mode
Line mode (comint-like live terminal with editable input area) is planned as a separate follow-up PR due to its complexity.
Test plan
M-x ghostel, verify semi-char works as beforeC-c M-denters char mode, all keys go to terminal,M-RETexitsC-c C-eenters emacs mode, full scrollback loads, isearch works,qexitsC-c C-tenters copy mode,C-c C-efrom copy switches to emacs:Char,:Copy,:EmacsindicatorsC-c C-jreturns to semi-char from all modesCloses #40