Merge branch 'hotfix/1.0.4.1'
* hotfix/1.0.4.1: Bump version Improve exception handling for get_char() Verify that shade_hl_id is set to prevent error message
This commit is contained in:
commit
6b8de708f1
@ -1,4 +1,4 @@
|
|||||||
*easymotion.txt* Version 1.0.4. Last change: 2011 Mar 28
|
*easymotion.txt* Version 1.0.4.1. Last change: 2011 Mar 28
|
||||||
|
|
||||||
|
|
||||||
______ __ ___ __ _
|
______ __ ___ __ _
|
||||||
|
@ -95,9 +95,14 @@
|
|||||||
function! EasyMotionF(visualmode, direction)
|
function! EasyMotionF(visualmode, direction)
|
||||||
call <SID>Prompt('Search for character')
|
call <SID>Prompt('Search for character')
|
||||||
|
|
||||||
let char = getchar()
|
let char = <SID>GetChar()
|
||||||
|
|
||||||
let re = '\C' . escape(nr2char(char), '.$^~')
|
" Check that we have an input char
|
||||||
|
if empty(char)
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
let re = '\C' . escape(char, '.$^~')
|
||||||
|
|
||||||
call <SID>EasyMotion(re, a:direction, a:visualmode ? visualmode() : '')
|
call <SID>EasyMotion(re, a:direction, a:visualmode ? visualmode() : '')
|
||||||
endfunction
|
endfunction
|
||||||
@ -107,12 +112,17 @@
|
|||||||
function! EasyMotionT(visualmode, direction)
|
function! EasyMotionT(visualmode, direction)
|
||||||
call <SID>Prompt('Search for character')
|
call <SID>Prompt('Search for character')
|
||||||
|
|
||||||
let char = getchar()
|
let char = <SID>GetChar()
|
||||||
|
|
||||||
|
" Check that we have an input char
|
||||||
|
if empty(char)
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
if a:direction == 1
|
if a:direction == 1
|
||||||
let re = '\C' . escape(nr2char(char), '.$^~') . '\zs.'
|
let re = '\C' . escape(char, '.$^~') . '\zs.'
|
||||||
else
|
else
|
||||||
let re = '\C.' . escape(nr2char(char), '.$^~')
|
let re = '\C.' . escape(char, '.$^~')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
call <SID>EasyMotion(re, a:direction, a:visualmode ? visualmode() : '')
|
call <SID>EasyMotion(re, a:direction, a:visualmode ? visualmode() : '')
|
||||||
@ -171,6 +181,20 @@
|
|||||||
call setline(line_num, line[a:key])
|
call setline(line_num, line[a:key])
|
||||||
endfor
|
endfor
|
||||||
endfunction " }}}
|
endfunction " }}}
|
||||||
|
function! s:GetChar() " {{{
|
||||||
|
let char = getchar()
|
||||||
|
|
||||||
|
if char == 27
|
||||||
|
" Escape key pressed
|
||||||
|
redraw
|
||||||
|
|
||||||
|
call <SID>Message('Cancelled')
|
||||||
|
|
||||||
|
return ''
|
||||||
|
endif
|
||||||
|
|
||||||
|
return nr2char(char)
|
||||||
|
endfunction " }}}
|
||||||
" }}}
|
" }}}
|
||||||
" Core functions {{{
|
" Core functions {{{
|
||||||
function! s:PromptUser(groups) "{{{
|
function! s:PromptUser(groups) "{{{
|
||||||
@ -230,7 +254,7 @@
|
|||||||
call <SID>Prompt('Group character')
|
call <SID>Prompt('Group character')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let input_char = nr2char(getchar())
|
let input_char = <SID>GetChar()
|
||||||
|
|
||||||
redraw
|
redraw
|
||||||
|
|
||||||
@ -242,9 +266,14 @@
|
|||||||
|
|
||||||
redraw
|
redraw
|
||||||
|
|
||||||
|
" Check that we have an input char
|
||||||
|
if empty(input_char)
|
||||||
|
throw 'Cancelled'
|
||||||
|
endif
|
||||||
|
|
||||||
" Check if the input char is valid
|
" Check if the input char is valid
|
||||||
if ! has_key(s:key_to_index, input_char) || s:key_to_index[input_char] >= targets_len
|
if ! has_key(s:key_to_index, input_char) || s:key_to_index[input_char] >= targets_len
|
||||||
throw 'Cancelled'
|
throw 'Invalid target'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if single_group
|
if single_group
|
||||||
@ -369,7 +398,7 @@
|
|||||||
redraw
|
redraw
|
||||||
|
|
||||||
" Remove shading
|
" Remove shading
|
||||||
if g:EasyMotion_shade
|
if g:EasyMotion_shade && exists('shade_hl_id')
|
||||||
call matchdelete(shade_hl_id)
|
call matchdelete(shade_hl_id)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user