From 9ba7ca19816e8e5cfeb29ced991486474d2cfba2 Mon Sep 17 00:00:00 2001 From: Dixeran Date: Tue, 1 Mar 2022 22:18:25 +0800 Subject: [PATCH] fix: tmux -CC capturep with extra \n (#1676) fix: tmux capturep with extra \n --- mux/src/tmux_commands.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mux/src/tmux_commands.rs b/mux/src/tmux_commands.rs index b28142931..ed76f189d 100644 --- a/mux/src/tmux_commands.rs +++ b/mux/src/tmux_commands.rs @@ -307,7 +307,8 @@ impl TmuxCommand for CapturePane { }; let unescaped = termwiz::tmux_cc::unvis(&result.output).context("unescape pane content")?; - let unescaped = unescaped.replace("\n", "\r\n"); + // capturep contents returned from guarded lines which always contain a tailing '\n' + let unescaped = &unescaped[0..unescaped.len().saturating_sub(1)].replace("\n", "\r\n"); let pane_map = tmux_domain.inner.remote_panes.borrow(); if let Some(pane) = pane_map.get(&self.0) {