Re: keysrc and prefix keys

Jeremy Henty <onepoint-YprzHiG/[email protected]>
Newsgroups gmane.comp.web.dillo.devel
Message-ID <[email protected]>
I wrote:

> I'll submit the patch for consideration in a few days.

OK, here it is.  It binds Ctrl-{Home,End} to {first,last}-tab.

I find it very useful.  There  is one oddity - sometimes Dillo ignores
the Ctrl key so that Ctrl-{Home,End} behave like {Home,End}.  This bug
usually disappears after  I Ctrl-{Shift,}-tab to some other  tab but I
do  not know  how to  consistently cause  or resolve  the  problem.  I
suspect that the patch is not the real cause.

Please comment.

Regards,

Jeremy Henty

_______________________________________________
Dillo-dev mailing list
[email protected]
http://lists.auriga.wearlab.de/cgi-bin/mailman/listinfo/dillo-dev
bind-ctrl-home-end-to-first-last-tab (text/plain, 3.1 KB)
# HG changeset patch
# Parent fe8d43537381cff1f998b0d30d10a5864bee4d18
diff -r fe8d43537381 -r 24e561077aa9 doc/user_help.html
--- a/doc/user_help.html	Sat Dec 10 06:31:10 2011 +0000
+++ b/doc/user_help.html	Sat Dec 10 11:44:25 2011 +0000
@@ -312,6 +312,8 @@
         Ctrl-PageDown              <td>TabKey          <td>Next tab
 <tr><td>Ctrl-Shift-TabKey or
         Ctrl-PageUp                <td>TabKey          <td>Previous tab
+<tr><td>Ctrl-Home                  <td>Home            <td>First tab
+<tr><td>Ctrl-End                   <td>End             <td>Last tab
 <tr><td>Esc                        <td>escape          <td>close dialog,
                                                            close findbar,<br>
                                                      Hide/show control panels
diff -r fe8d43537381 -r 24e561077aa9 src/keys.cc
--- a/src/keys.cc	Sat Dec 10 06:31:10 2011 +0000
+++ b/src/keys.cc	Sat Dec 10 11:44:25 2011 +0000
@@ -106,6 +106,8 @@
    { "left-tab"     , KEYS_LEFT_TAB     , FL_CTRL   , FL_Page_Up      },
    { "right-tab"    , KEYS_RIGHT_TAB    , FL_CTRL   , FL_Tab          },
    { "right-tab"    , KEYS_RIGHT_TAB    , FL_CTRL   , FL_Page_Down    },
+   { "first-tab"    , KEYS_FIRST_TAB    , FL_CTRL   , FL_Home         },
+   { "last-tab"     , KEYS_LAST_TAB     , FL_CTRL   , FL_End          },
    { "close-tab"    , KEYS_CLOSE_TAB    , FL_CTRL   , 'w'             },
    { "find"         , KEYS_FIND         , FL_CTRL   , 'f'             },
    { "websearch"    , KEYS_WEBSEARCH    , FL_CTRL   , 's'             },
diff -r fe8d43537381 -r 24e561077aa9 src/keysrc
--- a/src/keysrc	Sat Dec 10 06:31:10 2011 +0000
+++ b/src/keysrc	Sat Dec 10 11:44:25 2011 +0000
@@ -44,6 +44,10 @@
 # <ctrl>tab = right-tab
 # <ctrl>PageDown = right-tab
 
+# "first-tab" and "last-tab" switch to the first/last tab.
+# <ctrl>Home = first-tab
+# <ctrl>End = last-tab
+
 # "back" and "forward" move back/forward through the browser history.
 #backspace = back
 #<shift>backspace = forward
diff -r fe8d43537381 -r 24e561077aa9 src/uicmd.cc
--- a/src/uicmd.cc	Sat Dec 10 06:31:10 2011 +0000
+++ b/src/uicmd.cc	Sat Dec 10 11:44:25 2011 +0000
@@ -149,6 +149,8 @@
    void switch_tab(CustTabButton *cbtn);
    void prev_tab(void);
    void next_tab(void);
+   void first_tab(void);
+   void last_tab(void);
    void set_tab_label(UI *ui, const char *title);
 };
 
@@ -209,6 +211,12 @@
       } else if (cmd == KEYS_RIGHT_TAB) {
          next_tab();
          ret = 1;
+      } else if (cmd == KEYS_FIRST_TAB) {
+         first_tab();
+         ret = 1;
+      } else if (cmd == KEYS_LAST_TAB) {
+         last_tab();
+         ret = 1;
       } else if (cmd == KEYS_NEW_WINDOW) {
          a_UIcmd_open_url_nw(bw, NULL);
          ret = 1;
@@ -400,6 +408,18 @@
       switch_tab((CustTabButton*)Pack->child((idx+1<num_tabs()) ? idx+1 : 0));
 }
 
+void CustTabs::first_tab()
+{
+   if (num_tabs() > 0)
+      switch_tab((CustTabButton*)Pack->child(0));
+}
+
+void CustTabs::last_tab()
+{
+   if (num_tabs() > 0)
+      switch_tab((CustTabButton*)Pack->child(num_tabs()-1));
+}
+
 /*
  * Set this UI's tab button label
  */
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.