Method: Keys.isearch_prefix

Defined in:
lib/xiki/keys.rb

.isearch_prefix(shortcut_length = 2) ⇒ Object



729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
# File 'lib/xiki/keys.rb', line 729

def self.isearch_prefix shortcut_length=2
  # TODO Make search.stop set Keys.prefix (call .isearch_prefix)
    # Keys.prefix = self.isearch_prefix
  # and don't call .isearch_prefix

  # What about shortcut_length though?  Would we get weird results for search_foo_foo shortcuts? - just try it for now

  # Return it if character before key shortcut was C-u or C-0 - C-9...
  char = Keys.last(shortcut_length+1).to_i
  return :u if char == 21
  return :- if char == 67108909
  return (char - 67108912) if char >= 67108912 && char <= 67108921

  nil
end