From 165eb24ee419814ee282eff34bb8e1bbe012e5eb Mon Sep 17 00:00:00 2001 From: Travis Collins Date: Thu, 19 Sep 2024 21:50:53 -0600 Subject: [PATCH 1/2] Call Reset when clearing terminal screen --- plugin/vimux.vim | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/plugin/vimux.vim b/plugin/vimux.vim index f345d30..650c3e9 100644 --- a/plugin/vimux.vim +++ b/plugin/vimux.vim @@ -71,19 +71,9 @@ function! VimuxRunCommand(command, ...) abort if exists('a:1') let l:autoreturn = a:1 endif - let l:resetSequence = VimuxOption('VimuxResetSequence') let g:VimuxLastCommand = a:command - try - call VimuxTmux('copy-mode -q -t '.g:VimuxRunnerIndex) - catch - let l:versionString = s:tmuxProperty('#{version}') - if str2float(l:versionString) < 3.2 - let l:resetSequence = 'q '.l:resetSequence - endif - endtry - call VimuxSendKeys(l:resetSequence) - + call s:reset() call VimuxSendText(a:command) if l:autoreturn ==# 1 call VimuxSendKeys('Enter') @@ -178,6 +168,7 @@ endfunction function! VimuxClearTerminalScreen() abort if exists('g:VimuxRunnerIndex') && s:hasRunner(g:VimuxRunnerIndex) !=# -1 + call s:reset() call VimuxSendKeys('C-l') endif endfunction @@ -217,6 +208,20 @@ function! VimuxTmux(arguments) abort endif endfunction +function! s:reset() abort + let l:resetSequence = VimuxOption('VimuxResetSequence') + + try + call VimuxTmux('copy-mode -q -t '.g:VimuxRunnerIndex) + catch + let l:versionString = s:tmuxProperty('#{version}') + if str2float(l:versionString) < 3.2 + let l:resetSequence = 'q '.l:resetSequence + endif + endtry + call VimuxSendKeys(l:resetSequence) +endfunction + function! s:tmuxSession() abort return s:tmuxProperty('#S') endfunction From ea858524622f327ca4568fc65ed0e02827c9e07f Mon Sep 17 00:00:00 2001 From: Travis Collins Date: Fri, 20 Sep 2024 15:51:43 -0600 Subject: [PATCH 2/2] only exit copy-mode --- plugin/vimux.vim | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/plugin/vimux.vim b/plugin/vimux.vim index 650c3e9..67072a9 100644 --- a/plugin/vimux.vim +++ b/plugin/vimux.vim @@ -71,9 +71,11 @@ function! VimuxRunCommand(command, ...) abort if exists('a:1') let l:autoreturn = a:1 endif + let l:resetSequence = VimuxOption('VimuxResetSequence') let g:VimuxLastCommand = a:command - call s:reset() + call s:exitCopyMode() + call VimuxSendKeys(l:resetSequence) call VimuxSendText(a:command) if l:autoreturn ==# 1 call VimuxSendKeys('Enter') @@ -168,7 +170,7 @@ endfunction function! VimuxClearTerminalScreen() abort if exists('g:VimuxRunnerIndex') && s:hasRunner(g:VimuxRunnerIndex) !=# -1 - call s:reset() + call s:exitCopyMode() call VimuxSendKeys('C-l') endif endfunction @@ -208,18 +210,15 @@ function! VimuxTmux(arguments) abort endif endfunction -function! s:reset() abort - let l:resetSequence = VimuxOption('VimuxResetSequence') - +function! s:exitCopyMode() abort try call VimuxTmux('copy-mode -q -t '.g:VimuxRunnerIndex) catch let l:versionString = s:tmuxProperty('#{version}') if str2float(l:versionString) < 3.2 - let l:resetSequence = 'q '.l:resetSequence + call VimuxSendKeys('q') endif endtry - call VimuxSendKeys(l:resetSequence) endfunction function! s:tmuxSession() abort