Skip to content

Commit

Permalink
Move to next of last line by ^C
Browse files Browse the repository at this point in the history
  • Loading branch information
aycabta committed May 26, 2019
1 parent c49796c commit 2805c55
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/reline.rb
Expand Up @@ -347,10 +347,12 @@ def inner_readline(prompt, add_hist, multiline, &confirm_multiline_termination)
end
Reline::IOGate.move_cursor_column(0)
rescue StandardError => e
@@line_editor.finalize
Reline::IOGate.deprep(otio)
raise e
end

@@line_editor.finalize
Reline::IOGate.deprep(otio)
end

Expand Down
9 changes: 9 additions & 0 deletions lib/reline/line_editor.rb
Expand Up @@ -93,6 +93,15 @@ def reset(prompt = '', encoding = Encoding.default_external)
@rest_height = (Reline::IOGate.get_screen_size.first - 1) - Reline::IOGate.cursor_pos.y
@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.()
}
end

def finalize
Signal.trap('SIGINT', @old_trap)
end

def reset_variables(prompt = '', encoding = Encoding.default_external)
Expand Down

0 comments on commit 2805c55

Please sign in to comment.