From 60a656c72d9e2a4c4da6acfb7862572df7fd9020 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4ng=20Tr=E1=BA=A7n?= Date: Mon, 23 Nov 2026 14:05:40 +0700 Subject: [PATCH] fix: start on a terminal that reports 0x0, and give the macOS JSONL history path A pty whose size was never set reports 0 rows and 0 columns. termina's get_dimensions returned an error, Terminal::with_options panicked, and the panic recovery returned EOF, which logs the shell out. Fall back to 80x24 instead. The JSONL history path comes from dirs::data_local_dir(), which is ~/Library/Application Support on macOS, not ~/.local/share. Co-Authored-By: Claude Opus 5.5 --- docs/guide.md | 2 +- src/cli.rs | 2 +- src/history/mod.rs | 2 +- src/settings.rs | 2 +- vendor/README.md | 2 +- vendor/termina/src/terminal/unix.rs | 16 +++++++++------- 6 files changed, 14 insertions(+), 12 deletions(-) diff --git a/docs/guide.md b/docs/guide.md index ccee405..9888631 100644 --- a/docs/guide.md +++ b/docs/guide.md @@ -520,7 +520,7 @@ Optionally read Zsh history entries to make migrating to Bash easier. ## Flyline JSONL history backend -Flyline can use a structured JSONL history storage backend (`~/.local/share/flyline/history.jsonl`) that you can opt to use instead `~/.bash_history`. +Flyline can use a structured JSONL history storage backend (`~/.local/share/flyline/history.jsonl` on Linux, `~/Library/Application Support/flyline/history.jsonl` on macOS) that you can opt to use instead `~/.bash_history`. The main improvements are: - **Real-time syncing between sessions**: Synchronize command history instantly across open terminal windows and tabs. diff --git a/src/cli.rs b/src/cli.rs index 20482fb..b14372c 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -624,7 +624,7 @@ enum Commands { #[arg(long = "backend", value_enum)] backend: Option, - /// Specify a custom path for Flyline's JSONL history file (defaults to ~/.local/share/flyline/history.jsonl) + /// Specify a custom path for Flyline's JSONL history file (defaults to ~/.local/share/flyline/history.jsonl on Linux, ~/Library/Application Support/flyline/history.jsonl on macOS) #[arg(long = "jsonl-path", value_name = "PATH")] jsonl_path: Option, }, diff --git a/src/history/mod.rs b/src/history/mod.rs index 4576e9d..6f7bec4 100644 --- a/src/history/mod.rs +++ b/src/history/mod.rs @@ -675,7 +675,7 @@ impl HistoryManager { /// Refreshes history entries incrementally from the active backend. /// - /// When using `HistoryBackend::Flyline`, queries ~/.local/share/flyline/history.jsonl. + /// When using `HistoryBackend::Flyline`, queries the JSONL file (see `default_jsonl_path`). pub fn refresh_jsonl_backend(&mut self) { let path = self.ensure_jsonl_repopulated_if_needed(); let prev_offset = self.last_jsonl_read_offset.clone(); diff --git a/src/settings.rs b/src/settings.rs index e931ec0..96e3fed 100644 --- a/src/settings.rs +++ b/src/settings.rs @@ -16,7 +16,7 @@ pub use flycontent::palette::ColourTheme; Debug, Clone, Copy, PartialEq, Eq, Default, ValueEnum, serde::Serialize, serde::Deserialize, )] pub enum HistoryBackend { - /// Use Flyline's JSONL history file (~/.local/share/flyline/history.jsonl). + /// Use Flyline's JSONL history file (~/.local/share/flyline/history.jsonl on Linux, ~/Library/Application Support/flyline/history.jsonl on macOS). #[value(name = "flyline")] #[serde(rename = "flyline")] Flyline, diff --git a/vendor/README.md b/vendor/README.md index 51abb5f..2c1dfce 100644 --- a/vendor/README.md +++ b/vendor/README.md @@ -7,7 +7,7 @@ update them itself. | Directory | Upstream | Base commit | flyline's changes | |---|---|---|---| | `ratatui/` | [ratatui/ratatui](https://github.com/ratatui/ratatui) `main` | `5a28bec1` | An inline viewport positioned relative to its top row: cursor tracked in memory and never queried, resizable height, `viewport_top` for mapping mouse rows, synchronized output, autowrap off while drawing, erase instead of spaces, cells hidden behind wide glyphs skipped, no redundant cursor show/hide (HalFrgrd/ratatui `inline_viewport_improvments`, merged with upstream; see below) | -| `termina/` | [helix-editor/termina](https://github.com/helix-editor/termina) `master` | `7be7389f` (v0.4.0) | Raw device-attribute responses and no parser deadlock on DA2/DA3 or unhandled CSI (upstream PR #32), OSC 52 replies as `Paste`, the kitty base-layout key, `PlatformTerminal::with_reader` (upstream PR #31), an event buffer that keeps arrival order, and `TCSANOW` so typed-ahead input survives entering raw mode | +| `termina/` | [helix-editor/termina](https://github.com/helix-editor/termina) `master` | `7be7389f` (v0.4.0) | Raw device-attribute responses and no parser deadlock on DA2/DA3 or unhandled CSI (upstream PR #32), OSC 52 replies as `Paste`, the kitty base-layout key, `PlatformTerminal::with_reader` (upstream PR #31), an event buffer that keeps arrival order, `TCSANOW` so typed-ahead input survives entering raw mode, and an 80x24 fallback when the terminal reports a 0x0 size | | `skim/` | [skim-rs/skim](https://github.com/skim-rs/skim) `master` | `2160abbd` (5.9.0) | A `tui` feature, so `default-features = false, features = ["algos_only"]` builds only the matchers, without the TUI and runtime stack (HalFrgrd/skim, 1 commit) | Each directory is a `git subtree --squash`. It holds upstream's tree at the diff --git a/vendor/termina/src/terminal/unix.rs b/vendor/termina/src/terminal/unix.rs index 6157a23..196cdb4 100644 --- a/vendor/termina/src/terminal/unix.rs +++ b/vendor/termina/src/terminal/unix.rs @@ -206,14 +206,16 @@ impl Terminal for UnixTerminal { size.cols = cols; } } - if size.cols == 0 || size.rows == 0 { - Err(io::Error::new( - io::ErrorKind::Other, - "cannot read non-zero cols/rows from ioctl or COLUMNS/LINES environment variables", - )) - } else { - Ok(size) + // Some ptys (a freshly spawned one whose size was never set, for example) report 0x0 + // with no LINES/COLUMNS either. Assume the classic 80x24 rather than failing: a line + // editor that cannot start leaves the shell with no way to read a command. + if size.cols == 0 { + size.cols = 80; + } + if size.rows == 0 { + size.rows = 24; } + Ok(size) } fn event_reader(&self) -> EventReader {