From ba69773fbad54a65be485721991c04af4a28c19e Mon Sep 17 00:00:00 2001 From: 2Shirt <2xShirt@gmail.com> Date: Sat, 27 May 2023 19:08:48 -0700 Subject: [PATCH] Clear history when clearing a pane Helpful if the pane is resized to prevent cleared lines from returning. --- scripts/wk/ui/tmux.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/scripts/wk/ui/tmux.py b/scripts/wk/ui/tmux.py index d473f81f..4f376111 100644 --- a/scripts/wk/ui/tmux.py +++ b/scripts/wk/ui/tmux.py @@ -26,12 +26,16 @@ def capture_pane(pane_id=None): def clear_pane(pane_id=None): """Clear pane buffer for current or target pane.""" - cmd = ['tmux', 'send-keys', '-R'] + commands = [ + ['tmux', 'send-keys', '-R'], + ['tmux', 'clear-history'], + ] if pane_id: - cmd.extend(['-t', pane_id]) + commands = [[*cmd, '-t', pane_id] for cmd in commands] # Clear pane - run_program(cmd, check=False) + for cmd in commands: + run_program(cmd, check=False) def fix_layout(layout, forced=False):