-- 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: 0cfa2c6177a81fe9cf35e07bd6cdbd11ff7e8786:
path_to:
revision_to:

git.thebackupbox.net

rxvt-unicode-sixel

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

commit 0cfa2c6177a81fe9cf35e07bd6cdbd11ff7e8786
Author: Emanuele Giaquinta <emanuele.giaquinta@gmail.com>
Date:   Fri Dec 2 09:13:50 2011 +0000

    Reimplement keysym list parsing in a perl extension.

diff --git a/MANIFEST b/MANIFEST

index bf0107a5c9378a39259e6e5f9366e8dec196db0d..

index ..64f0fb3d963e6123a9f8992a9b22fe6ab20de6dd 100644

--- a/MANIFEST
+++ b/MANIFEST
@@ -153,6 +153,7 @@ src/perl/clipboard-osc
 src/perl/confirm-paste
 src/perl/digital-clock
 src/perl/example-refresh-hooks
+src/perl/keysym-list
 src/perl/kuake
 src/perl/macosx-clipboard
 src/perl/macosx-clipboard-native
diff --git a/doc/rxvt.1.pod b/doc/rxvt.1.pod

index 079ab6c17fe532742497e6eba6296dcc448f187f..

index ..9d252261c083914f3c7c0620f3479acb7f05441a 100644

--- a/doc/rxvt.1.pod
+++ b/doc/rxvt.1.pod
@@ -1206,7 +1206,8 @@ performed in an exact manner; however, the closest match is assured.
 I<string> may contain escape values (C<\n>: newline, C<\000>: octal
 number), see RESOURCES in C<man 7 X> for further details.

-You can define a range of keysyms in one shot by providing a I<string>
+You can define a range of keysyms in one shot by
+loading the C<keysym-list> perl extension and providing a I<string>
 with pattern B<list/PREFIX/MIDDLE/SUFFIX>, where the delimiter `/'
 should be a character not used by the strings.

diff --git a/src/keyboard.C b/src/keyboard.C

index 95103be1c26fe4e2c6e4295b0016c21a5eda17af..

index ..ff83e669451e87e4669906107b0272016259a1e5 100644

--- a/src/keyboard.C
+++ b/src/keyboard.C
@@ -114,35 +114,6 @@ keyboard_manager::register_user_translation (KeySym keysym, unsigned int state,
 {
   char *translation = rxvt_wcstoutf8 (ws);

-  if (strncmp (translation, "list", 4) == 0 && translation [4]
-      && strlen (translation) < STRING_MAX)
-    {
-      char *prefix = translation + 4;
-      char *middle = strchr  (prefix + 1, translation [4]);
-      char *suffix = strrchr (prefix + 1, translation [4]);
-
-      if (suffix && middle && suffix > middle + 1)
-        {
-          int range = suffix - middle - 1;
-          int prefix_len = middle - prefix - 1;
-          char buf[STRING_MAX];
-
-          memcpy (buf, prefix + 1, prefix_len);
-          strcpy (buf + prefix_len + 1, suffix + 1);
-
-          for (int i = 0; i < range; i++)
-            {
-              buf [prefix_len] = middle [i + 1];
-              register_translation (keysym + i, state, strdup (buf));
-            }
-
-          free (translation);
-          return;
-        }
-      else
-        rxvt_warn ("unable to parse list-type keysym '%s', processing as normal keysym.\n", translation);
-    }
-
   register_translation (keysym, state, translation);
 }

diff --git a/src/perl/keysym-list b/src/perl/keysym-list
new file mode 100644
index 0000000000000000000000000000000000000000..3488a39526e31ca89e399f0cd0e0e9edf886ee4f
--- /dev/null
+++ b/src/perl/keysym-list
@@ -0,0 +1,21 @@
+#! perl
+
+sub on_register_command {
+    my ($self, $keysym, $state, $str) = @_;
+
+    if ($str =~ /^list(.)/) {
+    	my @list = split /\Q$1/, $str;
+    	if (@list == 4) {
+    	    for (0 .. (length $list[2]) - 1) {
+    		my $middle = substr $list[2], $_, 1;
+    		my $def = $list[1] . $middle . $list[3];
+    		$self->register_command ($keysym + $_, $state, $def);
+    	    }
+    	    return 1;
+    	}
+
+	warn "unable to parse keysym '$str' as list, processing as normal keysym\n";
+    }
+
+    ()
+}

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

-- Response ended

-- Page fetched on Sun Jun 2 11:37:38 2024