Class: SearchTerm
Constant Summary collapse
- @@last_dash_search =
""
Class Method Summary collapse
- .keys ⇒ Object
-
.timed_search ⇒ Object
Does an isearch on the characters typed, until the user pauses more than .4 seconds.
Class Method Details
.keys ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/xiki/search_term.rb', line 9 def self.keys $el.define_key :isearch_mode_map, $el.kbd("C--") do # During isearch, remember current search term $el.isearch_done $el. match = $el.buffer_substring $el.match_beginning(0), $el.match_end(0) @@last_dash_search = match end Keys.set("C--") do started = $el.point chars = @@last_dash_search.size # Go to it $el.search_forward @@last_dash_search # Go forward again if you were already at it $el.search_forward @@last_dash_search if started == $el.point - chars # Back up to beginning $el.backward_char chars end end |
.timed_search ⇒ Object
Does an isearch on the characters typed, until the user pauses more than .4 seconds
28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/xiki/search_term.rb', line 28 def self.timed_search # isearch_forward c = $el.read_char "search: " # keys = self.to_letter(keys) $el.call_interactively $el.key_binding(c) while(c = $el.read_char("Input: ", nil, 0.40)) $el.call_interactively $el.key_binding(c) end end |