Skip to content

Commit 1ea4653

Browse files
authored
feat(terminal): nano editor builtin (#2547)
## What changed - New `nano` builtin in terminal sessions: a subset GNU-nano-style editor with typing, cursor keys, `^O` write out, `^X` exit (asks to save when modified), `^K`/`^U` cut and paste a line, `^W` search, `^G` help and `^C` cursor position. - `EDITOR=nano` works for the `$EDITOR` flows (`git commit` without `-m`). - The unsupported surface is documented as L-TERM-005; the threat model entry TM-DOS-119 now covers nano's buffers. ## Why Agents and the scripts they run often default to `nano`. Without it, `EDITOR=nano git commit` failed and agents had to know to switch to vi. ## Before / After Before: `nano notes.txt` → `nano: command not found` (127). After: `nano notes.txt` → editor with title bar and shortcut bar; type, `^O` Enter saves, `^X` returns to the prompt; `cat notes.txt` shows the edit. `EDITOR=nano git commit` → type the message, `^X`, `y` → commit created. ## Risk - Low. `terminal` feature only (off by default); new builtin, no change to existing commands. ## Checklist - [x] Tests added or updated - [x] Backward compatibility considered --- _Generated by [Claude Code](https://claude.ai/code/session_01X1g3pvv3cZECEhMrysGgJw)_
1 parent f7e2d61 commit 1ea4653

12 files changed

Lines changed: 751 additions & 9 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ jobs:
324324
# so the main "Run tests" step compiles them out entirely.
325325
- name: Run terminal tests
326326
run: |
327-
cargo test -p bashkit --features terminal,git --lib -- terminal:: builtins::vi:: builtins::pager::
327+
cargo test -p bashkit --features terminal,git --lib -- terminal:: builtins::vi:: builtins::pager:: builtins::nano::
328328
cargo test -p bashkit --features terminal --test integration -- terminal_tests l_term_
329329
cargo test -p bashkit --features terminal --doc terminal
330330

‎crates/bashkit/src/builtins/mod.rs‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ mod ls;
8383
mod man;
8484
mod mapfile;
8585
mod mkfifo;
86+
#[cfg(feature = "terminal")]
87+
mod nano;
8688
mod navigation;
8789
mod nl;
8890
mod numfmt;
@@ -233,6 +235,8 @@ pub use tsort::Tsort;
233235

234236
pub use jobctl::{Bg, Disown, Fg, Jobs, Kill, Pgrep, Ps};
235237
#[cfg(feature = "terminal")]
238+
pub use nano::Nano;
239+
#[cfg(feature = "terminal")]
236240
pub use pager::More;
237241
pub use sleep::Sleep;
238242
pub use sortuniq::{Sort, Uniq};

0 commit comments

Comments
 (0)