Hi,

On Mon, Mar 27, 2017 at 03:33:48AM +0300, Alex Efros wrote:

> I'd like to automatically switch off/on confirm-paste extension when I
> enter/leave $EDITOR. I can execute some command when enter/leave, like
> output some escape-sequence or something, but I didn't found any way to
> disable/enable (just don't call it hooks when it is disabled?) extension
> on-the-fly. Is this possible to do?

currently no, but you can use the attached patch to add enable/disable
commands for confirm-paste via the 777 OSC, i.e.,

\033]777;confirm-paste;enable\007

\033]777;confirm-paste;disable\007

Emanuele
diff --git a/src/perl/confirm-paste b/src/perl/confirm-paste
index 4b45238..0a0e992 100644
--- a/src/perl/confirm-paste
+++ b/src/perl/confirm-paste
@@ -21,6 +21,8 @@ sub msg {
 sub on_tt_paste {
    my ($self, $str) = @_;
 
+   return if $self->{disabled};
+
    my $count = ($str =~ tr/\012\015//);
 
    return unless $count;
@@ -55,3 +57,17 @@ sub key_press {
 
    1
 }
+
+sub on_osc_seq_perl {
+   my ($self, $osc, $resp) = @_;
+
+   return unless $osc =~ s/^confirm-paste;([^;]+)//;
+
+   if ($1 eq "enable") {
+      $self->{disabled} = 0;
+   } elsif ($1 eq "disable") {
+      $self->{disabled} = 1;
+   }
+
+   1
+}
_______________________________________________
rxvt-unicode mailing list
[email protected]
http://lists.schmorp.de/mailman/listinfo/rxvt-unicode

Reply via email to