aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorakbash <akbash@herdr.dev>2026-08-13 03:46:52 +0300
committerGitHub <noreply@github.com>2026-08-13 03:46:52 +0300
commit952729ee03e0939d7a9d893f87f24179cf0eb7cb (patch)
tree54c518f3fc3517e8c3611c92583e7e764625e1db /src
parenta4d52ab60282b2ad021cb90978a7ed4d3898704b (diff)
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>
Diffstat (limited to 'src')
-rw-r--r--src/app/input/navigate.rs12
-rw-r--r--src/pane.rs4
-rw-r--r--src/pane/terminal.rs5
-rw-r--r--src/terminal/runtime.rs4
4 files changed, 7 insertions, 18 deletions
diff --git a/src/app/input/navigate.rs b/src/app/input/navigate.rs
index beb2f363..afe9e6e0 100644
--- a/src/app/input/navigate.rs
+++ b/src/app/input/navigate.rs
@@ -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
diff --git a/src/pane.rs b/src/pane.rs
index 83921ab0..44f3fea9 100644
--- a/src/pane.rs
+++ b/src/pane.rs
@@ -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)
}
diff --git a/src/pane/terminal.rs b/src/pane/terminal.rs
index 3524df21..b853f0b0 100644
--- a/src/pane/terminal.rs
+++ b/src/pane/terminal.rs
@@ -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
}
diff --git a/src/terminal/runtime.rs b/src/terminal/runtime.rs
index 89544a74..156d18fd 100644
--- a/src/terminal/runtime.rs
+++ b/src/terminal/runtime.rs
@@ -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)
}