Reset isearch state on ctrl+c when using Readline 7
authorDavor Ocelic <docelic@crystallabs.io>
Thu, 16 May 2019 02:17:04 +0200
changeset 124 c1d8da18e65d
parent 121 6c14c49fe429
child 125 6530284a0ae4
Reset isearch state on ctrl+c when using Readline 7 This change does not affect Readline versions below 7. A fix for RL<7 would be to modify readline_state to turn off ISEARCH and set DONE, but changing these values through the Perl module does not appear to have visible effect.
shelldap
--- a/shelldap	Wed May 08 20:45:04 2019 +0200
+++ b/shelldap	Thu May 16 02:17:04 2019 +0200
@@ -2769,7 +2769,11 @@
 sub ctrl_c_handler {
 	print "\n";
 	$shell->term->on_new_line;
-	$shell->term->replace_line('', 0);
+	$shell->term->kill_text;
+	$shell->term->callback_sigcleanup;
+	$shell->term->free_line_state;
+	$shell->term->cleanup_after_signal;
+	$shell->term->callback_handler_remove;
 	$shell->term->redisplay;
 }
 my $sigaction = POSIX::SigAction->new( \&ctrl_c_handler, $sigset, 0);