@@ -739,14 +739,6 @@ function! s:GetVisualStartPosition(c_pos, v_start, v_end, search_direction) "{{{
739
739
endfunction " }}}
740
740
741
741
" -- 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 " }}}
750
742
function ! s: handleEmpty (input , visualmode ) " {{{
751
743
" if empty, reselect and return 1
752
744
if empty (a: input )
@@ -1104,12 +1096,8 @@ function! s:PromptUser(groups) "{{{
1104
1096
" }}}
1105
1097
1106
1098
" -- 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 ()
1113
1101
try
1114
1102
" Set lines with markers {{{
1115
1103
call s: SetLines (lines_items, ' marker' )
@@ -1156,21 +1144,8 @@ function! s:PromptUser(groups) "{{{
1156
1144
\ )
1157
1145
" }}}
1158
1146
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 ()
1174
1149
1175
1150
redraw
1176
1151
endtry " }}}
0 commit comments