Verified Commit 4dc330c4 authored by Anders Kaseorg's avatar Anders Kaseorg Committed by Zander Brown
Browse files

shortcuts: Enable Ctrl+PgUp/PgDn when multiple tabs

Users expect Ctrl+PgUp/PgDn to switch tabs, but some terminal
applications want to be able to use these keys themselves.  Make the
same compromise that gnome-terminal does, and let these keys switch
tabs _if_ there are multiple tabs in the current window to switch
between.

Fixes #118

.
Signed-off-by: Anders Kaseorg's avatarAnders Kaseorg <andersk@mit.edu>
parent 995a904b
Pipeline #398753 passed with stage
in 3 minutes and 42 seconds
......@@ -819,6 +819,25 @@ kgx_pages_current_status (KgxPages *self)
}
/**
* kgx_pages_count:
* @self: the #KgxPages
*
* Returns: number of #KgxTab s in @self
*/
int
kgx_pages_count (KgxPages *self)
{
KgxPagesPrivate *priv;
g_return_val_if_fail (KGX_IS_PAGES (self), KGX_NONE);
priv = kgx_pages_get_instance_private (self);
return hdy_tab_view_get_n_pages (HDY_TAB_VIEW (priv->view));
}
/**
* kgx_pages_get_children:
* @self: the #KgxPages
......
......@@ -45,6 +45,7 @@ void kgx_pages_add_page (KgxPages *self,
KgxTab *page);
void kgx_pages_remove_page (KgxPages *self,
KgxTab *page);
int kgx_pages_count (KgxPages *self);
GPtrArray *kgx_pages_get_children (KgxPages *self);
void kgx_pages_focus_page (KgxPages *self,
KgxTab *page);
......
......@@ -260,10 +260,11 @@ key_press_event (GtkWidget *widget,
*
* See https://gitlab.gnome.org/GNOME/libhandy/-/issues/422
*/
if ((keyval == GDK_KEY_Page_Up ||
keyval == GDK_KEY_KP_Page_Up ||
keyval == GDK_KEY_Page_Down ||
keyval == GDK_KEY_KP_Page_Down ||
if ((((keyval == GDK_KEY_Page_Up ||
keyval == GDK_KEY_KP_Page_Up ||
keyval == GDK_KEY_Page_Down ||
keyval == GDK_KEY_KP_Page_Down) &&
kgx_pages_count (KGX_PAGES (self->pages)) <= 1) ||
keyval == GDK_KEY_Home ||
keyval == GDK_KEY_KP_Home ||
keyval == GDK_KEY_End ||
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment