diff --git a/shard.yml b/shard.yml index c537668..6d8f8df 100644 --- a/shard.yml +++ b/shard.yml @@ -1,6 +1,6 @@ name: fancyline description: Readline-esque library with fancy features -version: 0.3.1 +version: 0.3.2 authors: - Stefan Merettig @@ -10,6 +10,6 @@ dependencies: github: Papierkorb/cute version: ">= 0.3.1" -crystal: 0.32.1 +crystal: 0.34.0 license: MPL-2 diff --git a/src/fancyline.cr b/src/fancyline.cr index 914aaf4..e42ff49 100644 --- a/src/fancyline.cr +++ b/src/fancyline.cr @@ -184,7 +184,7 @@ class Fancyline # Copied from IO::FileDescriptor, as this method is sadly `private`. protected def preserving_tc_mode(fd) if LibC.tcgetattr(fd, out mode) != 0 - raise Errno.new("Failed to enable raw mode on output") + raise RuntimeError.from_errno("Failed to enable raw mode on output") end before = mode diff --git a/src/fancyline/key.cr b/src/fancyline/key.cr index 89bbb47..7f9e290 100644 --- a/src/fancyline/key.cr +++ b/src/fancyline/key.cr @@ -4,11 +4,11 @@ class Fancyline module Key enum Control Backspace = 127 - Return = 13 # Same as Ctrl-M + Return = 13 # Same as Ctrl-M AltReturn - Tab = 9 + Tab = 9 ShiftTab - Escape = 27 + Escape = 27 CtrlA = 1 CtrlB = 2 @@ -156,6 +156,8 @@ class Fancyline when 81 then Control::F2 when 82 then Control::F3 when 83 then Control::F4 + else + nil end when 91 # Movement and F-keys case yield.try(&.ord) @@ -244,6 +246,8 @@ class Fancyline when 70 then Control::End when 72 then Control::Home when 90 then Control::ShiftTab + else + nil end # Alt-Letter keys when 97 then Control::AltA @@ -272,6 +276,8 @@ class Fancyline when 120 then Control::AltX when 121 then Control::AltY when 122 then Control::AltZ + else + nil end end end