On Fri, Dec 28, 2007 at 07:45:08AM -0800, Charlie Kester wrote:
> Is it possible to make elinks interpret a left arrow key as a quit
> command when navigation has reached the beginning of the history list?
> 
> Here's why I ask:  the mutt email client (and most of the rss readers
> I've tried) can be configured to invoke elinks to open urls found in an
> email or rss feed.  What's more, these tools also use the elinks-style
> right and left keys to move forward and backwards through the changing
> views.  
> 
> But this pleasant continuity comes to an abrupt halt when I've drilled
> down into elinks and then want to make my way back into whatever tool it
> was that I using before it was invoked.  Left arrow gets me back to the
> first url I visited, but no farther.  I have to switch gears and type
> 'q' or 'Q' in order to quit elinks.  Not only are these keys on the
> opposite side of my keyboard from the arrow keys -- which I admit is
> only a mild annoyance -- but I must also become consciously aware that
> I've reached a point where I must quit.  I.e., the elinks program has
> asserted itself and forced me to switch my attention to it and away from
> what could have been a seemless meandering through the information that
> I am actually interested in.
> 
> Please tell me if it's possible to make elinks "get out of the way"
> as all good tools do.
> 
> If it isn't possible yet, where do I make the feature request?

Report it as a bug at bugzilla.elinks.cz.

Here is the patch against 0.13.GIT.
You need to bind "Left" as the key for move-history-back-or-quit.
You could attach that patch to the bug report, too.
-- 
Witek
diff --git a/src/config/actions-main.inc b/src/config/actions-main.inc
index 21ff838..a6b7331 100644
--- a/src/config/actions-main.inc
+++ b/src/config/actions-main.inc
@@ -36,6 +36,7 @@ ACTION_(MAIN, "goto-url-home", GOTO_URL_HOME, N__("Go to the 
homepage"), 0),
 ACTION_(MAIN, "header-info", HEADER_INFO, N__("Show information about the 
current page protocol headers"), 0),
 ACTION_(MAIN, "history-manager", HISTORY_MANAGER, N__("Open history manager"), 
0),
 ACTION_(MAIN, "history-move-back", HISTORY_MOVE_BACK, N__("Return to the 
previous document in history"), 0),
+ACTION_(MAIN, "history-move-back-or-quit", HISTORY_MOVE_BACK_OR_QUIT, 
N__("Return to the previous document in history or quit"), 0),
 ACTION_(MAIN, "history-move-forward", HISTORY_MOVE_FORWARD, N__("Go forward in 
history"), 0),
 ACTION_(MAIN, "jump-to-link", JUMP_TO_LINK, N__("Jump to link"), 
ACTION_REQUIRE_VIEW_STATE | ACTION_JUMP_TO_LINK),
 ACTION_(MAIN, "keybinding-manager", KEYBINDING_MANAGER, N__("Open keybinding 
manager"), ACTION_RESTRICT_ANONYMOUS),
diff --git a/src/session/history.c b/src/session/history.c
index 281ffdc..5023665 100644
--- a/src/session/history.c
+++ b/src/session/history.c
@@ -11,6 +11,7 @@
 
 #include "cache/cache.h"
 #include "config/options.h"
+#include "dialogs/menu.h"
 #include "dialogs/status.h"
 #include "network/connection.h"
 #include "protocol/uri.h"
@@ -181,6 +182,27 @@ go_history_by_n(struct session *ses, int n)
        go_history(ses, loc);
 }
 
+void
+go_back_by_n_or_quit(struct session *ses, int n)
+{
+       struct location *loc = cur_loc(ses);
+
+       if (!loc) {
+               exit_prog(ses, 0);
+               return;
+       }
+       if (n >= 0) return;
+       while (n++) {
+               if (list_has_prev(ses->history.history, loc))
+                       loc = loc->prev;
+               else {
+                       exit_prog(ses, 0);
+                       return;
+               }
+       }
+       go_history(ses, loc);
+}
+
 /** Go backward in the history.  See go_history() description regarding
  * unpredictable effects on cur_loc() by this function. */
 void
diff --git a/src/session/history.h b/src/session/history.h
index ed28bf4..eeaf5ff 100644
--- a/src/session/history.h
+++ b/src/session/history.h
@@ -38,6 +38,11 @@ void go_history(struct session *ses, struct location *loc);
  * positive. */
 void go_history_by_n(struct session *ses, int n);
 
+/* Move back [EMAIL PROTECTED] n times if @a n is negative
+ * or quit when there is no more locations */
+void go_back_by_n_or_quit(struct session *ses, int n);
+
+
 void go_back(struct session *ses);
 void go_unback(struct session *ses);
 
diff --git a/src/viewer/action.c b/src/viewer/action.c
index 66e20bb..3826674 100644
--- a/src/viewer/action.c
+++ b/src/viewer/action.c
@@ -268,6 +268,15 @@ do_action(struct session *ses, enum main_action action_id, 
int verbose)
                        go_history_by_n(ses, -count);
                        break;
                }
+
+               case ACT_MAIN_HISTORY_MOVE_BACK_OR_QUIT:
+               {
+                       int count = int_max(1, eat_kbd_repeat_count(ses));
+
+                       go_back_by_n_or_quit(ses, -count);
+                       break;
+               }
+
                case ACT_MAIN_HISTORY_MOVE_FORWARD:
                {
                        int count = int_max(1, eat_kbd_repeat_count(ses));
_______________________________________________
elinks-users mailing list
[email protected]
http://linuxfromscratch.org/mailman/listinfo/elinks-users

Reply via email to