Skip to content

Commit

Permalink
Call Reset when clearing terminal screen
Browse files Browse the repository at this point in the history
  • Loading branch information
tradiff committed Sep 20, 2024
1 parent 64df7ce commit 165eb24
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions plugin/vimux.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 165eb24

Please sign in to comment.