Skip to content

Add ghostel-initial-input-mode to start in char or line mode#443

Merged
dakra merged 1 commit into
mainfrom
initial-input-mode
Jun 21, 2026
Merged

Add ghostel-initial-input-mode to start in char or line mode#443
dakra merged 1 commit into
mainfrom
initial-input-mode

Conversation

@dakra

@dakra dakra commented Jun 21, 2026

Copy link
Copy Markdown
Owner

Closes #435.

What

Adds a ghostel-initial-input-mode defcustom (semi-char (default) / char / line) that sets the input mode a freshly started ghostel terminal begins in, so users coming from shell can start directly in line mode without the sleep-for + ghostel-line-mode 'force advice from the issue.

How

  • char applies immediately at process start.
  • line cannot engage until the shell prints its first prompt to anchor the input region, so ghostel--apply-initial-input-mode arms a buffer-local flag and the existing per-redraw ghostel--line-mode-post-redraw path enters line mode on the first redraw that exposes a real prompt. The new ghostel--line-mode-startup-prompt-ready-p gates on an OSC 133 prompt property or ghostel-prompt-regexp (not the bare cursor), so it skips a blank pre-prompt screen. No timer/sleep.
  • A manual mode switch during startup wins (the flag is dropped without entering).
  • Scoped to the interactive ghostel entry point, not ghostel-exec.

Testing

  • make -j8 all passes (build, Zig, native, elisp, lint).
  • 4 new native tests in test/ghostel-line-mode-test.el: deferral-then-entry, char immediate, line arming, manual-override-cancels.
  • Live-verified in a real bash session: line defers then enters on the first prompt (~0.5s) with end-to-end editing + send; char enters immediately; semi-char unchanged.

@dakra
dakra force-pushed the initial-input-mode branch from 431c02f to 6b83581 Compare June 21, 2026 19:56
New defcustom `ghostel-initial-input-mode' (semi-char/char/line) sets
the input mode a freshly started `ghostel' terminal begins in, so users
coming from `shell' can start directly in line mode.

`char' applies immediately at process start.  `line' cannot engage
until the shell prints its first prompt to anchor the input region, so
`ghostel--apply-initial-input-mode' arms a buffer-local flag and the
existing per-redraw `ghostel--line-mode-post-redraw' path enters line
mode on the first redraw that exposes a real prompt
(`ghostel--line-mode-startup-prompt-ready-p' gates on an OSC 133 prompt
property or `ghostel-prompt-regexp', not the bare cursor, so it skips a
blank pre-prompt screen).  A manual mode switch during startup wins.

Scoped to the interactive `ghostel' entry point, not `ghostel-exec'.

Closes #435
@dakra
dakra force-pushed the initial-input-mode branch from 6b83581 to c4557b8 Compare June 21, 2026 19:59
@dakra
dakra merged commit c4557b8 into main Jun 21, 2026
24 checks passed
@dakra
dakra deleted the initial-input-mode branch June 21, 2026 20:13
@dakra
dakra temporarily deployed to github-pages June 21, 2026 20:13 — with GitHub Actions Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow to set the initial input-mode (e.g. 'line)

1 participant