Created
August 26, 2015 16:15
-
-
Save daphee/e5188a4fae02112d68be to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def bind_key(c : Char, f : Int32,Int32 -> Int32) | |
raise ArgumentError.new "not a valid ASCII character: '#{c}'" if !(0 <= c.ord <= 255) | |
wrapper = BindingProc.new {|count, key| LibReadline::Int.cast(f.call(count.to_i32, key.to_i32))} | |
LibReadline.rl_bind_key(c.ord, wrapper) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment