Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,3 +123,4 @@ ELYTerminal. A terminal on GPUI and Ely components. `PRD.md` says what it does;
- 2026-10-19: a double press on a session's row renames it, which a user asked for after 0.1.6. Ely's `ListItem::editor`, added to Ely for this, draws Ely's text field in the title's place; the row's first press selects the session, as ever, and its second opens the field, holding what the session is called, selected, with the focus. Enter keeps what it holds, Escape drops it, and a blur keeps it, as Windows Terminal's tab rename does; whenever the field closes while it still holds the window's focus, the shown terminal takes it, and a press that took the focus elsewhere keeps it there. A window that goes inactive blurs the field and keeps its focus there, so a field closed by that blur, focus handed to nothing, left the terminal deaf to keys once the window came back. A press inside the open field stays the field's: the row would select its session, which takes the focus to the terminal and ends the rename. The name, its ends trimmed, stands over the program's title in the row, the terminal's header and the window's title until renamed again, a program's later titles passing under it; an empty one gives the title back to the program. It lives as long as the session, and notifications keep the program's title. Each program title, each rename and its end are logged.
- 2026-10-19: on Windows 10 a blurred window's acrylic clears while the window moves or sizes, which a user asked for in issue #3 after 0.1.5, where dragging the window trailed the pointer by seconds: that DWM samples the acrylic again at each step of the move loop, while gpui draws through it every 10 ms, so the moves pile up; Windows 11's DWM does not, and keeps its acrylic. At start `RtlGetVersion` reads the build; below 22000 the main window's procedure is ELYTerminal's own, passing every message on to gpui's: at `WM_ENTERSIZEMOVE` a blurred window takes the accent gpui gives Transparent, a clear gradient, and at `WM_EXITSIZEMOVE` gpui's acrylic again, `SWP_FRAMECHANGED` telling DWM, both through `SetWindowCompositionAttribute` as gpui calls it. A window property marks the window blurred, set as the blur setting changes, so an opaque or clear window moves as it is; another marks it moving, from `WM_ENTERSIZEMOVE`, which Windows sends once, to `WM_EXITSIZEMOVE`, so a window blurred mid-move, which gpui gives acrylic at once, takes the clear accent again until the move ends. The log names which way the build goes and each switch. On Windows 11, with the build check raised, a drag by the terminal's header logged both switches and showed the glass clear mid-drag and blurred at rest; Windows 10 itself went untested, the fix following the issue's own trial.
- 2026-10-20: the repo moved from Gitea to GitHub, `ELY-Open-Source/ELYTerminal`, public, at the owner's ask: history, tags v0.1.0 to v0.1.6 and their releases with every build came along. CI runs macOS on the org's self-hosted `macos-arm64` runner, Windows on `ely-windows`, and Linux on GitHub's hosted `ubuntu-24.04` inside the Gitea job's own image, `docker.gitea.com/runner-images:ubuntu-24.04`, testing as a user it makes: on the hosted image itself zsh's `compinit` stopped at insecure folders and fish's prompt tripped over its hg. Release runs on `macos-signing` and needs the repo secrets `APPLE_API_ISSUER`, `APPLE_API_KEY_ID` and `APPLE_API_KEY_P8`. The update check reads GitHub's `releases/latest`, which skips drafts and prereleases.
- 2026-10-21: natural text editing on macOS, which the owner asked for: a switch in Settings › Terminal, `natural_text_editing`, off by default since it changes what Option and Command send to every program. On, Option-Left and Option-Right send ESC b and ESC f, Option-Backspace and Option-Delete ESC DEL and ESC d, Command-Left and Command-Right Ctrl-A and Ctrl-E, Command-Backspace and Command-Delete Ctrl-U and Ctrl-K, as iTerm2's preset sends them, whatever Option as Alt says; Shift or Ctrl with them, and Command with Option, pass by, and a release is dropped, since the bytes are no key event. The mapping runs in the key encoder before kitty's flags, as a user's compatibility choice, so a program gets the same bytes under every flag.
3 changes: 2 additions & 1 deletion PRD.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Ghostty is the bar for what the terminal does. ELYTerminal owns its engine on `a
- Box drawing (U+2500–U+257F), block elements (U+2580–U+259F) and powerline shapes (U+E0B0–U+E0B7) painted as geometry, so lines and segments join across cells.
- Fonts: JetBrains Mono by default, any installed font by choice, and fallback families tried in order for a character it lacks, a Chinese font after a Latin one among them; Nerd Font icons the font lacks come from a bundled Nerd Font.
- Cursor: block, bar, underline, hollow block; blinking per setting and per DECSCUSR; hollow when the window is not focused.
- Keys: xterm encoding with modifiers, application cursor mode, Option as Alt on macOS, the kitty keyboard protocol as the program sets its flags; a key Shift makes a symbol of goes as its own key with Shift, the symbol its alternate, as Ghostty sends it, on macOS and Windows. On Windows keys go as win32-input-mode records while ConPTY asks, as Windows Terminal sends them. Keypad keys type their characters, as Ghostty's do with mode 1035 on by default.
- Keys: xterm encoding with modifiers, application cursor mode, Option as Alt on macOS, and natural text editing there when the setting is on: Option-Left and Option-Right go as ESC b and ESC f, Option-Backspace and Option-Delete as ESC DEL and ESC d, Command-Left and Command-Right as Ctrl-A and Ctrl-E, Command-Backspace and Command-Delete as Ctrl-U and Ctrl-K, as iTerm2's preset; the kitty keyboard protocol as the program sets its flags; a key Shift makes a symbol of goes as its own key with Shift, the symbol its alternate, as Ghostty sends it, on macOS and Windows. On Windows keys go as win32-input-mode records while ConPTY asks, as Windows Terminal sends them. Keypad keys type their characters, as Ghostty's do with mode 1035 on by default.
- IME: marked text drawn at the cursor; committed text sent to the program.
- Mouse: select by character, word (double press) and line (triple press); Shift extends; mouse reporting (X10, normal, button, any; SGR and UTF-8); wheel scrolls back, or reports, or sends arrows on the alternate screen.
- Click to move: while the shell reads a line, as its OSC 133 marks say, a plain click on that line, past its prompt, moves the shell's cursor there, as Ghostty's `cursor-click-to-move`: a shell that takes clicks, as fish does, hears the click; others get arrow keys.
Expand Down Expand Up @@ -120,6 +120,7 @@ Cmd-, opens it; on Windows and Linux, which have no menu bar, so does a gear in
- Start in: Home, or the active session's folder.
- Scrollback lines.
- Option as Alt: off, left, right, both (macOS only).
- Natural text editing: a switch, off by default (macOS only); Option and Command edit by word and line, as the shell expects.
- Copy on select.
- Ely: a switch.
- Check for updates automatically: a switch, on by default, which checks at start and once a day.
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ The app writes its log to stderr. `RUST_LOG=elyterminal=debug` writes more; `tra
- Sessions: new, close and switch. A bell marks a hidden session's row and makes no sound. A row's mark shows what its programs report through OSC 7501, OSC 9;4 or herdr: waiting on you, an error, work with its progress, done or idle, else a failed last command. The mark is 3 by 3 dots: work ripples and waiting dips while they last. Hover over the mark lists each report.
- Notifications: while the window is in the background or the session hidden, a session that starts waiting, finishes or fails, and a program's OSC 9, 777 or 99, post a system notification, one a session every 3 seconds at most; a press shows the session. On macOS only the app bundle posts them, not `cargo run`.
- Cmd-Up and Cmd-Down, Ctrl-Shift-Up and Ctrl-Shift-Down off macOS, jump to the prompt before or after the view's top.
- Natural text editing on macOS, off by default in Settings › Terminal: Option-Left and Option-Right move by word, Option-Backspace and Option-Delete delete by word, Command-Left and Command-Right move to the line's ends, and Command-Backspace and Command-Delete delete to them, sent as the editing bytes the shell expects.
- A button at each end of the title bar hides or shows its side column, and a drag on the border between a side column and the terminal resizes it; the window opens as it was left, at the size and widths it was left at. On Windows and Linux a gear beside the right one opens Settings.
- Files shows the session's folder as a tree with Git's marks. Inside herdr the folder is that of herdr's focused pane.
- Git shows the branch, stages, unstages, discards, commits, lists recent commits and opens diffs, all through the `git` command line.
Expand Down
4 changes: 4 additions & 0 deletions TASKS.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,3 +163,7 @@ Progress truth. Top to bottom, one at a time. A task is ticked only after its co
## 33. Release

- [x] T64 Release v0.1.7 with T59 to T63, T65 and T66: version 0.1.7; the macOS disk image, the Windows zip and the Linux tarball, each from its script; the notes list what changed in English and Chinese.

## 34. Natural text editing on macOS

- [ ] T67 Natural text editing on macOS, which the owner asked for: a switch in Settings › Terminal, off by default, that sends Option-Left and Option-Right as ESC b and ESC f, Option-Backspace and Option-Delete as ESC DEL and ESC d, Command-Left and Command-Right as Ctrl-A and Ctrl-E, and Command-Backspace and Command-Delete as Ctrl-U and Ctrl-K, as iTerm2's preset.
4 changes: 3 additions & 1 deletion examples/shot/typing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use objc::{
};

/// US layout key codes and what each key types.
const KEYS: [(&str, u16, &str); 34] = [
const KEYS: [(&str, u16, &str); 36] = [
(",", 43, ","),
("a", 0, "a"),
("b", 11, "b"),
Expand Down Expand Up @@ -44,6 +44,8 @@ const KEYS: [(&str, u16, &str); 34] = [
("up", 126, "\u{F700}"),
("down", 125, "\u{F701}"),
("left", 123, "\u{F702}"),
("right", 124, "\u{F703}"),
("delete", 117, "\u{F728}"),
("f1", 122, "\u{F704}"),
("f5", 96, "\u{F708}"),
("f6", 97, "\u{F709}"),
Expand Down
3 changes: 3 additions & 0 deletions src/settings/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ pub struct Settings {
pub padding_y: f32,
pub scrollback: u32,
pub option_as_alt: OptionAsAlt,
/// Option and Command edit text by word and line, as macOS's text does.
pub natural_text_editing: bool,
pub copy_on_select: bool,
/// Ely peeks over the main window's top edge.
pub ely: bool,
Expand Down Expand Up @@ -111,6 +113,7 @@ impl Default for Settings {
padding_y: 8.0,
scrollback: 10_000,
option_as_alt: OptionAsAlt::Off,
natural_text_editing: false,
copy_on_select: false,
ely: true,
ely_left: 140.0,
Expand Down
16 changes: 14 additions & 2 deletions src/settings/window/terminal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const PLACES: [&str; 8] = [
];

impl SettingsWindow {
/// Shell, start in, scrollback, Option as Alt on macOS, copy on select, Ely and updates, then the shortcuts.
/// Shell, start in, scrollback, Option as Alt and natural text editing on macOS, copy on select, Ely and updates, then the shortcuts.
pub(super) fn terminal(&self, cx: &Context<Self>) -> Div {
let settings = SettingsStore::get(cx);
let this = cx.entity();
Expand Down Expand Up @@ -92,7 +92,19 @@ impl SettingsWindow {
settings.option_as_alt,
|settings, option| settings.option_as_alt = option,
);
section = section.row(SettingsRow::new("Option as Alt").control(option));
let natural = switch(
&this,
"natural_text_editing",
settings.natural_text_editing,
|settings, on| settings.natural_text_editing = on,
);
section = section
.row(SettingsRow::new("Option as Alt").control(option))
.row(
SettingsRow::new("Natural text editing")
.description("Option and Command edit by word and line")
.control(natural),
);
}
let copy = switch(
&this,
Expand Down
10 changes: 10 additions & 0 deletions src/term/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,16 @@ impl TerminalView {
action,
unshifted: facts.unshifted,
};
#[cfg(target_os = "macos")]
if crate::settings::SettingsStore::get(cx).natural_text_editing
&& let Some(bytes) = keys::natural(&key, modifiers.alt)
{
if action != Action::Release {
log::trace!("terminal {}: {key:?} sends {bytes:?}", self.pty.pid);
self.input(bytes.to_vec(), cx);
}
return Some(false);
}
let mode = *self.pty.term.lock().mode();
let kitty = Kitty {
disambiguate: mode.contains(TermMode::DISAMBIGUATE_ESC_CODES),
Expand Down
18 changes: 18 additions & 0 deletions src/term/keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,24 @@ pub fn encode(key: &Key, app_cursor: bool, kitty: Kitty) -> Option<Vec<u8>> {
}
}

/// Readline's bytes for macOS's editing keys; `option` is Option held, whatever Option as Alt says. The caller drops a release.
pub fn natural(key: &Key, option: bool) -> Option<&'static [u8]> {
if key.ctrl || key.shift {
return None;
}
Some(match (key.name, option, key.platform) {
("left", true, false) => b"\x1bb",
("right", true, false) => b"\x1bf",
("backspace", true, false) => b"\x1b\x7f",
("delete", true, false) => b"\x1bd",
("left", false, true) => b"\x01",
("right", false, true) => b"\x05",
("backspace", false, true) => b"\x15",
("delete", false, true) => b"\x0b",
_ => return None,
})
}

/// Pasted text for the program; bracketed text loses ESC and Ctrl-C, as in alacritty.
pub fn paste(text: &str, bracketed: bool) -> Vec<u8> {
if bracketed {
Expand Down
40 changes: 40 additions & 0 deletions src/term/keys/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,46 @@ fn super_is_kittys_eighth_bit() {
);
}

#[test]
fn natural_text_editing_sends_readlines_bytes() {
let bytes = |spec: &'static str| {
let pressed = key(spec, "");
natural(&pressed, pressed.alt)
.map(|bytes| String::from_utf8(bytes.to_vec()).expect("utf-8"))
};
let cases = [
("alt+left", "\x1bb"),
("alt+right", "\x1bf"),
("alt+backspace", "\x1b\x7f"),
("alt+delete", "\x1bd"),
("cmd+left", "\x01"),
("cmd+right", "\x05"),
("cmd+backspace", "\x15"),
("cmd+delete", "\x0b"),
];
for (spec, want) in cases {
assert_eq!(bytes(spec).as_deref(), Some(want), "{spec}");
}
for spec in [
"alt+shift+left",
"ctrl+alt+left",
"cmd+alt+left",
"alt+up",
"cmd+c",
] {
assert_eq!(bytes(spec), None, "{spec}");
}
let released = Key {
action: Action::Release,
..key("alt+left", "")
};
assert_eq!(
natural(&released, true),
Some(b"\x1bb".as_slice()),
"a release is the caller's to drop"
);
}

#[test]
fn pastes_end_lines_with_cr_or_go_bracketed_without_escapes() {
assert_eq!(paste("a\r\nb\nc", false), b"a\rb\rc");
Expand Down
1 change: 1 addition & 0 deletions tasks/acceptance.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ What no check reached: no real KWin drew the blur; of Wayland desktops, only Hyp
| Appearance: theme grids, dark theme, font, size, line height, ligatures, cursor and preview, opacity, blur, padding | T17 | T17 review | Pass |
| On Omarchy, the Omarchy theme first in the grid | T27 | on X11 with Omarchy's theme folder, the Omarchy card leads the grid, chosen, over a preview in its colors | Pass |
| Terminal: scrollback, Option as Alt (macOS), copy on select | T18 | T18 review | Pass |
| Terminal: natural text editing (macOS), a switch off by default: Option-Left and Option-Right, Option-Backspace and Option-Delete, Command-Left and Command-Right, Command-Backspace and Command-Delete send the editing bytes | T67 | `term::keys::natural_text_editing_sends_readlines_bytes`; on macOS `shot` sent the eight keys to `/bin/sh` under `stty raw`, whose `od` recorded `1b 62 1b 66 1b 7f 1b 64 01 05 15 0b`, and with the switch off Command-Left still sent `1b 5b 31 3b 39 44` | Pass |
| Terminal: Ely, a switch | T46 | on macOS the switch closed her window and saved `"ely": false`, a start with it showed no Ely, and the switch brought her back | Pass |
| Terminal: check for updates automatically, a switch on by default, at start and once a day; Updates says what the check found, with Check now, and Download for a newer release; an automatic check that finds one posts a notification that opens its page | T56 | `updates` tests: a tag reads as three numbers, only a later release is newer, by its numbers, and Gitea's release body reads; under Xorg's dummy screen the app's start checked through curl and logged `0.1.5 is the latest`, the two rows stood under Ely, before Shortcuts, Check now checked again, the switch saved `check_updates` off and on, and turning it on checked at once; a build named 0.1.4 logged `0.1.5 is out`, its row read `ELYTerminal 0.1.5 is out; this is 0.1.4` beside Download and Check now, and Download logged that it opened the release's page; the notification's press went unexercised, since the container held no notification daemon | Pass |
| Terminal: every shortcut, with a search | T26 | read from the keymap, the bindings that apply in the main window's terminal; on X11 the list showed this platform's keys (Ctrl+Shift+T, Alt+1 and on), and typing "paste" left Edit's Paste, Ctrl+Shift+V | Pass |
Expand Down