aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authoraycabta <aycabta@gmail.com>2019-09-14 00:16:08 +0900
committeraycabta <aycabta@gmail.com>2019-09-14 00:16:31 +0900
commit98f919ed47a136c9a51c7ab5fa39ffb4965a1687 (patch)
treeec9b549a1cc92db1f2dba91149e8f3fb803f0578 /lib
parent70fe473c7dfee70d0e9ee7346c260493e3aceaf2 (diff)
downloadruby-98f919ed47a136c9a51c7ab5fa39ffb4965a1687.tar.gz
The stdlib readline should raise Interrupt when pressing C-c
Diffstat (limited to 'lib')
-rw-r--r--lib/reline/line_editor.rb3
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb
index 2e964cb74a..75281c6c8b 100644
--- a/lib/reline/line_editor.rb
+++ b/lib/reline/line_editor.rb
@@ -65,9 +65,8 @@ class Reline::LineEditor
@screen_size = Reline::IOGate.get_screen_size
reset_variables(prompt, encoding)
@old_trap = Signal.trap('SIGINT') {
- scroll_down(@highest_in_all - @first_line_started_from)
- Reline::IOGate.move_cursor_column(0)
@old_trap.call if @old_trap.respond_to?(:call) # can also be string, ex: "DEFAULT"
+ raise Interrupt
}
Reline::IOGate.set_winch_handler do
@rest_height = (Reline::IOGate.get_screen_size.first - 1) - Reline::IOGate.cursor_pos.y