summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2014-03-05 18:00:20 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2014-03-05 18:00:20 +0900
commitd66b02b0cd5c575357157f98292731511a609230 (patch)
treeec1758b7eeebb0ce8256ca4f2a94d4781fb35ead
parentb3182c330413d64dbdf60efdc2fbad3b5a28d12f (diff)
Disable typeahead optimization in Ruby 1.8
-rwxr-xr-xfzf8
1 files changed, 5 insertions, 3 deletions
diff --git a/fzf b/fzf
index 8e040e14..a8cf9dd8 100755
--- a/fzf
+++ b/fzf
@@ -462,7 +462,9 @@ class FZF
}
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}'
def width str
str.gsub(@@wrx, ' ').length rescue str.length
@@ -784,8 +786,8 @@ class FZF
c = C.getch
if ch = to_printable(c)
chs = [ch]
- C.stdscr.timeout = 0
- while c = C.getch
+ C.stdscr.timeout = 0 if AFTER_1_9
+ while AFTER_1_9 && c = C.getch
if ch = to_printable(c)
chs << ch
else