Disable typeahead optimization in Ruby 1.8
This commit is contained in:
parent
b3182c3304
commit
d66b02b0cd
8
fzf
8
fzf
@ -462,7 +462,9 @@ class FZF
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
if RUBY_VERSION.split('.').map { |e| e.rjust(3, '0') }.join > '001009'
|
AFTER_1_9 = RUBY_VERSION.split('.').map { |e| e.rjust(3, '0') }.join >= '001009'
|
||||||
|
|
||||||
|
if AFTER_1_9
|
||||||
@@wrx = Regexp.new '\p{Han}|\p{Katakana}|\p{Hiragana}|\p{Hangul}'
|
@@wrx = Regexp.new '\p{Han}|\p{Katakana}|\p{Hiragana}|\p{Hangul}'
|
||||||
def width str
|
def width str
|
||||||
str.gsub(@@wrx, ' ').length rescue str.length
|
str.gsub(@@wrx, ' ').length rescue str.length
|
||||||
@ -784,8 +786,8 @@ class FZF
|
|||||||
c = C.getch
|
c = C.getch
|
||||||
if ch = to_printable(c)
|
if ch = to_printable(c)
|
||||||
chs = [ch]
|
chs = [ch]
|
||||||
C.stdscr.timeout = 0
|
C.stdscr.timeout = 0 if AFTER_1_9
|
||||||
while c = C.getch
|
while AFTER_1_9 && c = C.getch
|
||||||
if ch = to_printable(c)
|
if ch = to_printable(c)
|
||||||
chs << ch
|
chs << ch
|
||||||
else
|
else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user