Sha256: a1d8fbdcfd755a7ea92f6e6461a1574a17e62c437e0b4fd636251036d0dc756e

Contents?: true

Size: 567 Bytes

Versions: 7

Compression:

Stored size: 567 Bytes

Contents

module Textbringer
  module Commands
    define_command(:toggle_input_method,
                   doc: "Toggel input method.") do |name = nil|
      if name.nil? && current_prefix_arg
        name = read_input_method_name("Input method: ")
      end
      Buffer.current.toggle_input_method(name)
    end

    def read_input_method_name(prompt, default: CONFIG[:default_input_method])
      f = ->(s) {
        complete_for_minibuffer(s.tr("-", "_"), InputMethod.list)
      }
      read_from_minibuffer(prompt, completion_proc: f, default: default)
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
textbringer-1.4.1 lib/textbringer/commands/input_method.rb
textbringer-1.3.0 lib/textbringer/commands/input_method.rb
textbringer-1.2.0 lib/textbringer/commands/input_method.rb
textbringer-1.1.2 lib/textbringer/commands/input_method.rb
textbringer-1.1.1 lib/textbringer/commands/input_method.rb
textbringer-1.1.0 lib/textbringer/commands/input_method.rb
textbringer-1.0.9 lib/textbringer/commands/input_method.rb