Use input{save,restore}()

This commit is contained in:
Marco Hinz 2014-11-20 14:21:01 +01:00
parent 07e10a15a0
commit 82496e92aa

View file

@ -163,10 +163,12 @@ function! startify#session_load(...) abort
echomsg 'There are no sessions...' echomsg 'There are no sessions...'
return return
endif endif
call inputsave()
let spath = s:session_dir . s:sep . (exists('a:1') let spath = s:session_dir . s:sep . (exists('a:1')
\ ? a:1 \ ? a:1
\ : input('Load this session: ', fnamemodify(v:this_session, ':t'), 'custom,startify#session_list_as_string')) \ : input('Load this session: ', fnamemodify(v:this_session, ':t'), 'custom,startify#session_list_as_string'))
\ | redraw \ | redraw
call inputrestore()
if filereadable(spath) if filereadable(spath)
if get(g:, 'startify_session_persistence') if get(g:, 'startify_session_persistence')
\ && exists('v:this_session') \ && exists('v:this_session')
@ -200,7 +202,9 @@ function! startify#session_save(...) abort
if exists('a:1') if exists('a:1')
let sname = a:1 let sname = a:1
else else
call inputsave()
let sname = input('Save under this session name: ', fnamemodify(v:this_session, ':t'), 'custom,startify#session_list_as_string') let sname = input('Save under this session name: ', fnamemodify(v:this_session, ':t'), 'custom,startify#session_list_as_string')
call inputrestore()
redraw redraw
if empty(sname) if empty(sname)
echo 'You gave an empty name!' echo 'You gave an empty name!'
@ -276,10 +280,12 @@ function! startify#session_delete(...) abort
return return
endif endif
call inputsave()
let spath = s:session_dir . s:sep . (exists('a:1') let spath = s:session_dir . s:sep . (exists('a:1')
\ ? a:1 \ ? a:1
\ : input('Delete this session: ', fnamemodify(v:this_session, ':t'), 'custom,startify#session_list_as_string')) \ : input('Delete this session: ', fnamemodify(v:this_session, ':t'), 'custom,startify#session_list_as_string'))
\ | redraw \ | redraw
call inputrestore()
echo 'Really delete '. spath .'? [y/n]' | redraw echo 'Really delete '. spath .'? [y/n]' | redraw
if (nr2char(getchar()) == 'y') if (nr2char(getchar()) == 'y')