
Hi,
But, I think it's still useful to have, since now the action can be performed with just 1 click, instead of 2. Also browsers like Firefox offer the middle-click back feature like this, so it might be more intuitive for some users.
I think it makes sense for Dillo to behave in that way as well. However, the current patch needs some changes. See below:
diff -upr a/src/nav.c b/src/nav.c --- a/src/nav.c Mon Apr 21 21:42:32 2025 +++ b/src/nav.c Sun Apr 27 10:11:36 2025 @@ -447,6 +447,20 @@ void a_Nav_back(BrowserWindow *bw) }
/* + * Send the browser back to previous page in new tab + */ +void a_Nav_back_nt(BrowserWindow *bw) +{ + int idx = a_Nav_stack_ptr(bw); + + a_Nav_cancel_expect(bw);
I think you don't want to a_Nav_cancel_expect(), as this will make the current tab stop loading.
+ if (--idx >= 0){ + a_UIcmd_set_msg(bw, ""); + a_UIcmd_open_url_nt(bw, a_History_get_url(NAV_UIDX(bw,idx)), -1); ^add space
The problem with this approach is that the newly opened tab lacks the history of the previous tab. The same problem happens with the current mechanism by opening the history menu and middle clicking an item, but it would be nice to keep it if not too hard. This new behavior needs to be added to doc/user_help.in.html as well, as otherwise it will be hard to guess.
+ } +} + +/* * Send the browser to next page in the history list */ void a_Nav_forw(BrowserWindow *bw) diff -upr a/src/nav.h b/src/nav.h --- a/src/nav.h Mon Apr 21 21:42:32 2025 +++ b/src/nav.h Sun Apr 27 10:12:00 2025 @@ -18,6 +18,7 @@ void a_Nav_push(BrowserWindow *bw, const DilloUrl *url const DilloUrl *requester); void a_Nav_repush(BrowserWindow *bw); void a_Nav_back(BrowserWindow *bw); +void a_Nav_back_nt(BrowserWindow *bw); void a_Nav_forw(BrowserWindow *bw);
We probably should add another one for the forward button too, right?
void a_Nav_home(BrowserWindow *bw); void a_Nav_reload(BrowserWindow *bw); diff -upr a/src/ui.cc b/src/ui.cc --- a/src/ui.cc Mon Apr 21 21:42:32 2025 +++ b/src/ui.cc Sun Apr 27 10:13:45 2025 @@ -312,6 +312,8 @@ static void b1_cb(Fl_Widget *wid, void *cb_data) case UI_BACK: if (b == FL_LEFT_MOUSE) { a_UIcmd_back(a_UIcmd_get_bw_by_widget(wid)); + } else if (b == FL_MIDDLE_MOUSE) { + a_UIcmd_back_nt(a_UIcmd_get_bw_by_widget(wid)); } else if (b == FL_RIGHT_MOUSE) { a_UIcmd_back_popup(a_UIcmd_get_bw_by_widget(wid), wid->x(), wid->y() + wid->h()); diff -upr a/src/uicmd.cc b/src/uicmd.cc --- a/src/uicmd.cc Mon Apr 21 21:42:32 2025 +++ b/src/uicmd.cc Sun Apr 27 10:12:30 2025 @@ -868,6 +868,14 @@ void a_UIcmd_back(void *vbw) }
/* + * Send the browser back to previous page in a new tab + */ +void a_UIcmd_back_nt(void *vbw) +{ + a_Nav_back_nt((BrowserWindow*)vbw); +} + +/* * Popup the navigation menu of the Back button */ void a_UIcmd_back_popup(void *vbw, int x, int y) diff -upr a/src/uicmd.hh b/src/uicmd.hh --- a/src/uicmd.hh Mon Apr 21 21:42:32 2025 +++ b/src/uicmd.hh Sun Apr 27 10:12:51 2025 @@ -29,6 +29,7 @@ void a_UIcmd_open_url(BrowserWindow *bw, const DilloUr void a_UIcmd_open_url_nw(BrowserWindow *bw, const DilloUrl *url); void a_UIcmd_open_url_nt(void *vbw, const DilloUrl *url, int focus); void a_UIcmd_back(void *vbw); +void a_UIcmd_back_nt(void *vbw); void a_UIcmd_back_popup(void *vbw, int x, int y); void a_UIcmd_forw(void *vbw); void a_UIcmd_forw_popup(void *vbw, int x, int y);