fix: preserve logical lines in scrollback editor (#2735)

refs #2733

Co-authored-by: akbash-bot <300245827+akbash-bot@users.noreply.github.com>
Co-authored-by: Can Celik <ogulcancelik@gmail.com>
This commit is contained in:
akbash
2026-08-13 03:46:52 +03:00
committed by GitHub
co-authored by akbash-bot Can Celik
parent a4d52ab602
commit 952729ee03
5 changed files with 8 additions and 18 deletions
+1
View File
@@ -20,6 +20,7 @@
- Experimental pane graphics now support bounded named layers, acknowledged full-RGBA primary-layer direct file frames on audited local terminals, owned BGRA fallback, exact pixel mouse input, and placement-only resize replay.
### Fixed
- `prefix+e` now preserves logical lines when opening soft-wrapped scrollback in an editor. (#2733)
- Prefix keybindings now disambiguate layout-aware shifted punctuation, so a shifted `\` no longer triggers `prefix+|` on keyboard layouts where the same key produces both characters. (#2674)
- Remote clients now continue redrawing at very large terminal sizes instead of freezing when a full ANSI frame exceeds the transport limit. (#2670)
- OpenCode panes now track the root conversation selected in their own TUI for native restore without adopting activity from attached clients. (#2450)
+6 -6
View File
@@ -975,7 +975,8 @@ impl App {
.state
.runtime_for_pane_in_workspace(&self.terminal_runtimes, ws_idx, pane_id)
.ok_or_else(|| std::io::Error::other("focused pane has no scrollback runtime"))?
.recent_text(usize::MAX);
.recent_unwrapped_text_snapshot(usize::MAX)
.text;
let path = write_scrollback_temp_file(&scrollback)?;
@@ -3661,7 +3662,7 @@ navigate_pane_down = "ctrl+j"
#[cfg(unix)]
#[tokio::test]
async fn edit_scrollback_key_opens_focused_runtime_scrollback_in_editor_pane() {
async fn edit_scrollback_key_preserves_logical_lines_in_editor_pane() {
let (_api_tx, api_rx) = tokio::sync::mpsc::unbounded_channel();
let mut app = App::new(
&Config::default(),
@@ -3675,10 +3676,10 @@ navigate_pane_down = "ctrl+j"
workspace.tabs[0].runtimes.insert(
root_pane,
crate::terminal::TerminalRuntime::test_with_scrollback_bytes(
20,
5,
5,
4096,
b"alpha\nbeta\n",
b"ABCDEFGHIJ\r\nKLMNO",
),
);
app.state.workspaces = vec![workspace];
@@ -3708,8 +3709,7 @@ navigate_pane_down = "ctrl+j"
}
let content = wait_for_file(&output_path);
assert!(content.contains("alpha"));
assert!(content.contains("beta"));
assert_eq!(content, "ABCDEFGHIJ\nKLMNO");
assert_eq!(app.state.mode, Mode::Terminal);
assert!(
app.state.terminals.values().any(|terminal| terminal
-4
View File
@@ -2727,10 +2727,6 @@ impl PaneRuntime {
self.terminal.agent_osc_progress()
}
pub fn recent_text(&self, lines: usize) -> String {
self.terminal.recent_text(lines)
}
pub(crate) fn recent_text_snapshot(&self, lines: usize) -> TerminalReadSnapshot {
self.terminal.recent_text_snapshot(lines)
}
+1 -4
View File
@@ -427,10 +427,6 @@ impl PaneTerminal {
self.ghostty.detection_text()
}
pub fn recent_text(&self, lines: usize) -> String {
self.ghostty.recent_text(lines)
}
pub(crate) fn recent_text_snapshot(&self, lines: usize) -> TerminalReadSnapshot {
self.ghostty.recent_text_snapshot(lines)
}
@@ -1959,6 +1955,7 @@ impl GhosttyPaneTerminal {
.unwrap_or_default()
}
#[cfg(test)]
pub fn recent_text(&self, lines: usize) -> String {
self.recent_text_snapshot(lines).text
}
-4
View File
@@ -361,10 +361,6 @@ impl TerminalRuntime {
self.0.agent_osc_progress()
}
pub fn recent_text(&self, lines: usize) -> String {
self.0.recent_text(lines)
}
pub(crate) fn recent_text_snapshot(&self, lines: usize) -> crate::pane::TerminalReadSnapshot {
self.0.recent_text_snapshot(lines)
}