From b7817a88b371dc1efee08a09e4276e67fdfb8713 Mon Sep 17 00:00:00 2001 From: Boris Faure Date: Tue, 31 May 2016 21:33:00 +0200 Subject: [PATCH] keys: add Shift+Home to get to the top of the backlog. Closes T3582 --- README | 1 + man/terminology.1 | 4 ++++ src/bin/config.c | 8 ++++++-- src/bin/keyin.c | 13 +++++++++++++ src/bin/termio.c | 10 ++++++++++ src/bin/termio.h | 1 + 6 files changed, 35 insertions(+), 2 deletions(-) diff --git a/README b/README index f4fc5742..5bdac3b9 100644 --- a/README +++ b/README @@ -40,6 +40,7 @@ Shift+PgUp = Scroll 1 page up Shift+PgDn = Scroll 1 page down Shift+Up = Scroll 1 line up Shift+Down = Scroll 1 line down +Shift+Home = Scroll to the top of the backlog Shift+Left = switch focus to previous terminal inside a window Shift+Right = switch focus to next terminal inside a window Shift+Insert = Paste Clipboard (ctrl+v/c) selection diff --git a/man/terminology.1 b/man/terminology.1 index 374926bc..89230755 100644 --- a/man/terminology.1 +++ b/man/terminology.1 @@ -196,6 +196,10 @@ Scroll terminology one line up Scroll terminology one line down . .TP +.B Shift+Home +Scroll terminology to the top of the backlog +. +.TP .B Shift+Left Switch focus to previous terminal inside a window when using splits, or the previous tab. diff --git a/src/bin/config.c b/src/bin/config.c index d2c38948..fabfbe49 100644 --- a/src/bin/config.c +++ b/src/bin/config.c @@ -7,7 +7,7 @@ #include "col.h" #include "utils.h" -#define CONF_VER 12 +#define CONF_VER 13 #define LIM(v, min, max) {if (v >= max) v = max; else if (v <= min) v = min;} @@ -364,6 +364,7 @@ _add_default_keys(Config *config) ADD_KB("KP_Divide", 0, 0, 1, 0, "copy_clipboard"); ADD_KB("Left", 0, 0, 1, 0, "term_prev"); ADD_KB("Right", 0, 0, 1, 0, "term_next"); + ADD_KB("Home", 0, 0, 1, 0, "top_backlog"); } void @@ -603,7 +604,10 @@ config_load(const char *key) _add_key(config, "Left", 0, 0, 1, 0, "term_prev"); _add_key(config, "Right", 0, 0, 1, 0, "term_next"); /*pass through*/ - case CONF_VER: /* 12 */ + case 12: + _add_key(config, "Home", 0, 0, 1, 0, "top_backlog"); + /*pass through*/ + case CONF_VER: /* 13 */ config->version = CONF_VER; break; default: diff --git a/src/bin/keyin.c b/src/bin/keyin.c index d2b62fc4..e50be510 100644 --- a/src/bin/keyin.c +++ b/src/bin/keyin.c @@ -603,6 +603,18 @@ cb_scroll_down_line(Evas_Object *termio_obj) return EINA_TRUE; } +static Eina_Bool +cb_scroll_top_backlog(Evas_Object *termio_obj) +{ + Termpty *ty = termio_pty_get(termio_obj); + + if (!ty || ty->altbuf) + return EINA_FALSE; + + termio_scroll_top_backlog(termio_obj); + return EINA_TRUE; +} + static Shortcut_Action _actions[] = { @@ -611,6 +623,7 @@ static Shortcut_Action _actions[] = {"one_page_down", gettext_noop("Scroll one page down"), cb_scroll_down_page}, {"one_line_up", gettext_noop("Scroll one line up"), cb_scroll_up_line}, {"one_line_down", gettext_noop("Scroll one line down"), cb_scroll_down_line}, + {"top_backlog", gettext_noop("Go to the top of the backlog"), cb_scroll_top_backlog}, {"group", gettext_noop("Copy/Paste"), NULL}, {"copy_primary", gettext_noop("Copy selection to Primary buffer"), cb_copy_primary}, diff --git a/src/bin/termio.c b/src/bin/termio.c index 77100bcb..9ec14449 100644 --- a/src/bin/termio.c +++ b/src/bin/termio.c @@ -342,6 +342,16 @@ termio_scroll_set(Evas_Object *obj, int scroll) _smart_apply(obj); } +void +termio_scroll_top_backlog(Evas_Object *obj) +{ + Termio *sd = evas_object_smart_data_get(obj); + EINA_SAFETY_ON_NULL_RETURN(sd); + sd->scroll = INT32_MAX; + _remove_links(sd, obj); + _smart_apply(obj); +} + const char * termio_title_get(Evas_Object *obj) { diff --git a/src/bin/termio.h b/src/bin/termio.h index 3b660e99..0567de6d 100644 --- a/src/bin/termio.h +++ b/src/bin/termio.h @@ -14,6 +14,7 @@ char *termio_selection_get(Evas_Object *obj, int c1x, int c1y, int c2x, int c2y, size_t *len, Eina_Bool right_trim); Eina_Bool termio_selection_exists(const Evas_Object *obj); +void termio_scroll_top_backlog(Evas_Object *obj); void termio_scroll_delta(Evas_Object *obj, int delta, int by_page); void termio_scroll_set(Evas_Object *obj, int scroll); void termio_scroll(Evas_Object *obj, int direction, int start_y, int end_y);