-- Leo's gemini proxy

-- Connecting to git.thebackupbox.net:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini

repo: rxvt-unicode-sixel
action: commit
revision:
path_from:
revision_from: 8398508cc93b63f6a9235795105a5c3e6f6ca460:
path_to:
revision_to:

git.thebackupbox.net

rxvt-unicode-sixel

git://git.thebackupbox.net/rxvt-unicode-sixel

commit 8398508cc93b63f6a9235795105a5c3e6f6ca460
Author: Emanuele Giaquinta <emanuele.giaquinta@gmail.com>
Date:   Sat Jul 24 13:04:27 2010 +0000

    Add confirm-paste script.

diff --git a/Changes b/Changes

index 55b5824f866d3bb2e274991d1211039cbcf32181..

index ..c96f1e6e97a4da6380b7a4752ee4242d45388929 100644

--- a/Changes
+++ b/Changes
@@ -21,6 +21,7 @@ TODO: perl-shell-window? perl-unix-socket?

 TODO:        - upgrade to libev-4.00.

+	- new perl extension "confirm-paste" (Emanuele Giaquinta).
 	- new on_tt_paste perl hook and tt_paste perl binding (Emanuele Giaquinta).
 	- fix utmpx detection on upcoming FreeBSD 9.
 	- Use COMPOUND_TEXT encoding for WM_NAME/WM_ICON_NAME value when it
diff --git a/MANIFEST b/MANIFEST

index 13d7bd7037aa5b370dba1587df5e54a6deb8f2a0..

index ..66015d374624617a51ea4f66aa181418b941c885 100644

--- a/MANIFEST
+++ b/MANIFEST
@@ -165,6 +165,7 @@ src/perl/digital-clock
 src/perl/macosx-clipboard
 src/perl/macosx-clipboard-native
 src/perl/overlay-osc
+src/perl/confirm-paste

 libev/ev.h
 libev/ev++.h
diff --git a/src/perl/confirm-paste b/src/perl/confirm-paste
new file mode 100644
index 0000000000000000000000000000000000000000..2b8771ec5928927c1f46d2bea68e5d559dd0459f
--- /dev/null
+++ b/src/perl/confirm-paste
@@ -0,0 +1,43 @@
+#! perl
+
+sub msg {
+   my ($self, $msg) = @_;
+
+   $self->{overlay} = $self->overlay (0, -1, $self->strwidth ($msg), 1);
+   $self->{overlay}->set (0, 0, $msg);
+}
+
+sub on_tt_paste {
+   my ($self, $str) = @_;
+
+   my $count = ($str =~ tr/\012\015//);
+
+   return unless $count;
+
+   $self->{paste} = \$str;
+   $self->msg ("Paste of $count lines, continue? (y/n)");
+   $self->enable (key_press => \&key_press);
+
+   1
+}
+
+sub leave {
+   my ($self) = @_;
+
+   $self->{paste} = undef;
+   delete $self->{overlay};
+   $self->disable ("key_press");
+}
+
+sub key_press {
+   my ($self, $event, $keysym, $string) =  @_;
+
+   if ($keysym == 121) { # y
+      $self->tt_paste (${$self->{paste}});
+      $self->leave;
+   } elsif ($keysym == 110) { # n
+      $self->leave;
+   }
+
+   1
+}
diff --git a/src/urxvt.pm b/src/urxvt.pm

index 5d904db7c14c251f56b733ea80b582b0008ea578..

index ..15911f09de407d69d9b4faca736979015fa1e6a6 100644

--- a/src/urxvt.pm
+++ b/src/urxvt.pm
@@ -395,6 +395,11 @@ Displays a very simple digital clock in the upper right corner of the
 window. Illustrates overwriting the refresh callbacks to create your own
 overlays or changes.

+=item confirm-paste
+
+Displays a confirmation dialog when a paste containing at least a full
+line is detected.
+
 =back

 =head1 API DOCUMENTATION

-----END OF PAGE-----

-- Response ended

-- Page fetched on Sun Jun 2 09:56:25 2024