@@ -739,14 +739,6 @@ function! s:GetVisualStartPosition(c_pos, v_start, v_end, search_direction) "{{{
739739endfunction " }}}
740740
741741" -- Others ------------------------------
742- function ! s: is_cmdwin () " {{{
743- return bufname (' %' ) == # ' [Command Line]'
744- endfunction " }}}
745- function ! s: should_use_wundo () " {{{
746- " wundu cannot use in command-line window and
747- " unless undolist is not empty
748- return ! s: is_cmdwin () && undotree ().seq_last != 0
749- endfunction " }}}
750742function ! s: handleEmpty (input , visualmode ) " {{{
751743 " if empty, reselect and return 1
752744 if empty (a: input )
@@ -1104,12 +1096,8 @@ function! s:PromptUser(groups) "{{{
11041096 " }}}
11051097
11061098 " -- Put labels on targets & Get User Input & Restore all {{{
1107- " Save undo tree {{{
1108- let s: undo_file = tempname ()
1109- if s: should_use_wundo ()
1110- execute " wundo" s: undo_file
1111- endif
1112- " }}}
1099+ " Save undo tree
1100+ let undo_lock = EasyMotion#undo#save ()
11131101 try
11141102 " Set lines with markers {{{
11151103 call s: SetLines (lines_items, ' marker' )
@@ -1156,21 +1144,8 @@ function! s:PromptUser(groups) "{{{
11561144 \ )
11571145 " }}}
11581146
1159- " Restore undo tree {{{
1160- if s: should_use_wundo () && filereadable (s: undo_file )
1161- silent execute " rundo" s: undo_file
1162- call delete (s: undo_file )
1163- unlet s: undo_file
1164- else
1165- " Break undo history (undobreak)
1166- let old_undolevels = &undolevels
1167- set undolevels = -1
1168- keepjumps call setline (' .' , getline (' .' ))
1169- let &undolevels = old_undolevels
1170- unlet old_undolevels
1171- " FIXME: Error occur by GundoToggle for undo number 2 is empty
1172- keepjumps call setline (' .' , getline (' .' ))
1173- endif " }}}
1147+ " Restore undo tree
1148+ call undo_lock.restore ()
11741149
11751150 redraw
11761151 endtry " }}}
0 commit comments