-- 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: 1826e3db1e3989095ffa0934c4afeaf8a2087a56:
path_to:
revision_to:

git.thebackupbox.net

rxvt-unicode-sixel

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

commit 1826e3db1e3989095ffa0934c4afeaf8a2087a56
Author: Emanuele Giaquinta <emanuele.giaquinta@gmail.com>
Date:   Sat Apr 30 18:45:38 2011 +0000

    Remove 'list' syntax for keysym resources, it serves no useful purpose.

diff --git a/Changes b/Changes

index ead6583b2350c920a41952d889764b0651434bb7..

index ..00e2626eff1f4655bf05bedb977edcdd95e8199b 100644

--- a/Changes
+++ b/Changes
@@ -21,6 +21,8 @@ TODO: perl-shell-window? perl-unix-socket?
 TODO: command line editing when icanon?

 TODO: perl selection object creation/destruction
+        - remove 'list' syntax for keysym resources, as it serves no useful purpose.
+          If you need it, poke us and provide a use case.
         - fix alpha channel support. Premultiply alpha in colours if the visual
           supports an alpha channel, as xrender expects premultiplied alpha
           (Emanuele Giaquinta).
diff --git a/doc/rxvt.1.pod b/doc/rxvt.1.pod

index bd44a0b9258a6731a65c91ce89728bfe869baf14..

index ..50b35333e39b227bf880eee5a01a52714853c6f0 100644

--- a/doc/rxvt.1.pod
+++ b/doc/rxvt.1.pod
@@ -1163,20 +1163,6 @@ 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>
-with pattern B<list/PREFIX/MIDDLE/SUFFIX>, where the delimiter `/'
-should be a character not used by the strings.
-
-Its usage can be demonstrated by an example:
-
-  URxvt.keysym.M-C-0x61:    list|\033<M-C-|abc|>
-
-The above line is equivalent to the following three lines:
-
-  URxvt.keysym.Meta-Control-0x61:    \033<M-C-a>
-  URxvt.keysym.Meta-Control-0x62:    \033<M-C-b>
-  URxvt.keysym.Meta-Control-0x63:    \033<M-C-c>
-
 If I<string> takes the form of C<command:STRING>, the specified B<STRING>
 is interpreted and executed as @@RXVT_NAME@@'s control sequence. For
 example the following means "change the current locale to C<zh_CN.GBK>
diff --git a/src/keyboard.C b/src/keyboard.C

index 085eef1cca8c904d13852e699d7aeff93e2da3f7..

index ..d803894fa588fadaf1113b79f762b1238c74800d 100644

--- a/src/keyboard.C
+++ b/src/keyboard.C
@@ -88,7 +88,7 @@ compare_priority (keysym_t *a, keysym_t *b)
 //else if (a->state != b->state) // this behavior is to be discussed
 //  return b->state - a->state;
   else
-    return b->range - a->range;
+    return 0;
 }

 ////////////////////////////////////////////////////////////////////////////////
@@ -135,26 +135,10 @@ keyboard_manager::register_user_translation (KeySym keysym, unsigned int state,
     {
       key->keysym = keysym;
       key->state  = state;
-      key->range  = 1;
       key->str    = translation;
       key->type   = keysym_t::STRING;

-      if (strncmp (translation, "list", 4) == 0 && translation [4])
-        {
-          char *middle = strchr  (translation + 5, translation [4]);
-          char *suffix = strrchr (translation + 5, translation [4]);
-
-          if (suffix && middle && suffix > middle + 1)
-            {
-              key->type  = keysym_t::LIST;
-              key->range = suffix - middle - 1;
-
-              memmove (translation, translation + 4, strlen (translation + 4) + 1);
-            }
-          else
-            rxvt_warn ("cannot parse list-type keysym '%s', treating as normal keysym.\n", translation);
-        }
-      else if (strncmp (translation, "builtin:", 8) == 0)
+      if (strncmp (translation, "builtin:", 8) == 0)
         key->type = keysym_t::BUILTIN;

       register_keymap (key);
@@ -205,8 +189,6 @@ keyboard_manager::dispatch (rxvt_term *term, KeySym keysym, unsigned int state)

       if (key.type != keysym_t::BUILTIN)
         {
-          int keysym_offset = keysym - key.keysym;
-
           wchar_t *wc = rxvt_utf8towcs (key.str);
           char *str = rxvt_wcstombs (wc);
           // TODO: do (some) translations, unescaping etc, here (allow \u escape etc.)
@@ -217,24 +199,6 @@ keyboard_manager::dispatch (rxvt_term *term, KeySym keysym, unsigned int state)
               case keysym_t::STRING:
                 output_string (term, str);
                 break;
-
-              case keysym_t::LIST:
-                {
-                  char buf[STRING_MAX];
-
-                  char *prefix, *middle, *suffix;
-
-                  prefix = str;
-                  middle = strchr  (prefix + 1, *prefix);
-                  suffix = strrchr (middle + 1, *prefix);
-
-                  memcpy (buf, prefix + 1, middle - prefix - 1);
-                  buf [middle - prefix - 1] = middle [keysym_offset + 1];
-                  strcpy (buf + (middle - prefix), suffix + 1);
-
-                  output_string (term, buf);
-                }
-                break;
             }

           free (str);
@@ -257,11 +221,10 @@ keyboard_manager::setup_hash ()

   // determine hash bucket size
   for (i = 0; i < keymap.size (); ++i)
-    for (int j = min (keymap [i]->range, KEYSYM_HASH_BUCKETS) - 1; j >= 0; --j)
-      {
-        hashkey = (keymap [i]->keysym + j) & KEYSYM_HASH_MASK;
-        ++hash_bucket_size [hashkey];
-      }
+    {
+      hashkey = keymap [i]->keysym & KEYSYM_HASH_MASK;
+      ++hash_bucket_size [hashkey];
+    }

   // now we know the size of each bucket
   // compute the index of each bucket
@@ -280,22 +243,21 @@ keyboard_manager::setup_hash ()
   // fill in sorted_keymap
   // it is sorted in each bucket
   for (i = 0; i < keymap.size (); ++i)
-    for (int j = min (keymap [i]->range, KEYSYM_HASH_BUCKETS) - 1; j >= 0; --j)
-      {
-        hashkey = (keymap [i]->keysym + j) & KEYSYM_HASH_MASK;
+    {
+      hashkey = keymap [i]->keysym & KEYSYM_HASH_MASK;

-        index = hash [hashkey] + hash_bucket_size [hashkey];
+      index = hash [hashkey] + hash_bucket_size [hashkey];

-        while (index > hash [hashkey]
-               && compare_priority (keymap [i], sorted_keymap [index - 1]) > 0)
-          {
-            sorted_keymap [index] = sorted_keymap [index - 1];
-            --index;
-          }
+      while (index > hash [hashkey]
+             && compare_priority (keymap [i], sorted_keymap [index - 1]) > 0)
+        {
+          sorted_keymap [index] = sorted_keymap [index - 1];
+          --index;
+        }

-        sorted_keymap [index] = keymap [i];
-        ++hash_bucket_size [hashkey];
-      }
+      sorted_keymap [index] = keymap [i];
+      ++hash_bucket_size [hashkey];
+    }

   keymap.swap (sorted_keymap);

@@ -306,8 +268,7 @@ keyboard_manager::setup_hash ()
       index = hash[i];
       for (int j = 0; j < hash_bucket_size [i]; ++j)
         {
-          if (keymap [index + j]->range == 1)
-            assert (i == (keymap [index + j]->keysym & KEYSYM_HASH_MASK));
+          assert (i == (keymap [index + j]->keysym & KEYSYM_HASH_MASK));

           if (j)
             assert (compare_priority (keymap [index + j - 1],
@@ -319,16 +280,13 @@ keyboard_manager::setup_hash ()
   for (i = 0; i < sorted_keymap.size (); ++i)
     {
       keysym_t *a = sorted_keymap[i];
-      for (int j = 0; j < a->range; ++j)
-        {
-          int index = find_keysym (a->keysym + j, a->state);
+      int index = find_keysym (a->keysym, a->state);

-          assert (index >= 0);
-          keysym_t *b = keymap [index];
-          assert (i == index	// the normally expected result
-                  || IN_RANGE_INC (a->keysym + j, b->keysym, b->keysym + b->range)
-                  && compare_priority (a, b) <= 0);	// is effectively the same or a closer match
-        }
+      assert (index >= 0);
+      keysym_t *b = keymap [index];
+      assert (i == index	// the normally expected result
+              || a->keysym == b->keysym
+              && compare_priority (a, b) <= 0);	// is effectively the same or a closer match
     }
 #endif
 }
@@ -346,7 +304,7 @@ keyboard_manager::find_keysym (KeySym keysym, unsigned int state)
     {
       keysym_t *key = keymap [index];

-      if (key->keysym <= keysym && keysym < key->keysym + key->range
+      if (key->keysym == keysym
           // match only the specified bits in state and ignore others
           && (key->state & state) == key->state)
         return index;
diff --git a/src/keyboard.h b/src/keyboard.h

index c48677fba0201ed6657f624ba34e3edfc7107e53..

index ..5beabc6becf249780fb753f2836a4c6505340091 100644

--- a/src/keyboard.h
+++ b/src/keyboard.h
@@ -57,7 +57,7 @@ typedef void (keyevent_handler) (rxvt_term *rt,
 struct keysym_t
 {
   enum keysym_type {
-    STRING, LIST, BUILTIN,
+    STRING, BUILTIN,
   };

   KeySym      keysym;
@@ -65,7 +65,6 @@ struct keysym_t
   /* the higher bits are preserved for Meta/NumLock keys */
   /* which are mapped to corresponding lower bits at register time */
   uint16_t    state;    /* indicates each modifiers' DOWN/UP status         */
-  uint16_t    range;    /* =1: single keysym; >1: a of range keysyms        */
   keysym_type type;
   const char  *str;      /* would normally be a keycode translation in UTF-8 */
 };

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

-- Response ended

-- Page fetched on Sun Jun 2 13:50:29 2024