summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBoris Faure <billiob@gmail.com>2016-05-31 21:33:00 +0200
committerBoris Faure <billiob@gmail.com>2016-05-31 21:34:44 +0200
commitb7817a88b371dc1efee08a09e4276e67fdfb8713 (patch)
tree960f6ef877b8132d104c3171e499b62e147ec5aa /src
parent4e5a07e795517b02d38dd274ac207b63c45d3736 (diff)
keys: add Shift+Home to get to the top of the backlog. Closes T3582
Diffstat (limited to 'src')
-rw-r--r--src/bin/config.c8
-rw-r--r--src/bin/keyin.c13
-rw-r--r--src/bin/termio.c10
-rw-r--r--src/bin/termio.h1
4 files changed, 30 insertions, 2 deletions
diff --git a/src/bin/config.c b/src/bin/config.c
index d2c3894..fabfbe4 100644
--- a/src/bin/config.c
+++ b/src/bin/config.c
@@ -7,7 +7,7 @@
7#include "col.h" 7#include "col.h"
8#include "utils.h" 8#include "utils.h"
9 9
10#define CONF_VER 12 10#define CONF_VER 13
11 11
12#define LIM(v, min, max) {if (v >= max) v = max; else if (v <= min) v = min;} 12#define LIM(v, min, max) {if (v >= max) v = max; else if (v <= min) v = min;}
13 13
@@ -364,6 +364,7 @@ _add_default_keys(Config *config)
364 ADD_KB("KP_Divide", 0, 0, 1, 0, "copy_clipboard"); 364 ADD_KB("KP_Divide", 0, 0, 1, 0, "copy_clipboard");
365 ADD_KB("Left", 0, 0, 1, 0, "term_prev"); 365 ADD_KB("Left", 0, 0, 1, 0, "term_prev");
366 ADD_KB("Right", 0, 0, 1, 0, "term_next"); 366 ADD_KB("Right", 0, 0, 1, 0, "term_next");
367 ADD_KB("Home", 0, 0, 1, 0, "top_backlog");
367} 368}
368 369
369void 370void
@@ -603,7 +604,10 @@ config_load(const char *key)
603 _add_key(config, "Left", 0, 0, 1, 0, "term_prev"); 604 _add_key(config, "Left", 0, 0, 1, 0, "term_prev");
604 _add_key(config, "Right", 0, 0, 1, 0, "term_next"); 605 _add_key(config, "Right", 0, 0, 1, 0, "term_next");
605 /*pass through*/ 606 /*pass through*/
606 case CONF_VER: /* 12 */ 607 case 12:
608 _add_key(config, "Home", 0, 0, 1, 0, "top_backlog");
609 /*pass through*/
610 case CONF_VER: /* 13 */
607 config->version = CONF_VER; 611 config->version = CONF_VER;
608 break; 612 break;
609 default: 613 default:
diff --git a/src/bin/keyin.c b/src/bin/keyin.c
index d2b62fc..e50be51 100644
--- a/src/bin/keyin.c
+++ b/src/bin/keyin.c
@@ -603,6 +603,18 @@ cb_scroll_down_line(Evas_Object *termio_obj)
603 return EINA_TRUE; 603 return EINA_TRUE;
604} 604}
605 605
606static Eina_Bool
607cb_scroll_top_backlog(Evas_Object *termio_obj)
608{
609 Termpty *ty = termio_pty_get(termio_obj);
610
611 if (!ty || ty->altbuf)
612 return EINA_FALSE;
613
614 termio_scroll_top_backlog(termio_obj);
615 return EINA_TRUE;
616}
617
606 618
607static Shortcut_Action _actions[] = 619static Shortcut_Action _actions[] =
608{ 620{
@@ -611,6 +623,7 @@ static Shortcut_Action _actions[] =
611 {"one_page_down", gettext_noop("Scroll one page down"), cb_scroll_down_page}, 623 {"one_page_down", gettext_noop("Scroll one page down"), cb_scroll_down_page},
612 {"one_line_up", gettext_noop("Scroll one line up"), cb_scroll_up_line}, 624 {"one_line_up", gettext_noop("Scroll one line up"), cb_scroll_up_line},
613 {"one_line_down", gettext_noop("Scroll one line down"), cb_scroll_down_line}, 625 {"one_line_down", gettext_noop("Scroll one line down"), cb_scroll_down_line},
626 {"top_backlog", gettext_noop("Go to the top of the backlog"), cb_scroll_top_backlog},
614 627
615 {"group", gettext_noop("Copy/Paste"), NULL}, 628 {"group", gettext_noop("Copy/Paste"), NULL},
616 {"copy_primary", gettext_noop("Copy selection to Primary buffer"), cb_copy_primary}, 629 {"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 77100bc..9ec1444 100644
--- a/src/bin/termio.c
+++ b/src/bin/termio.c
@@ -342,6 +342,16 @@ termio_scroll_set(Evas_Object *obj, int scroll)
342 _smart_apply(obj); 342 _smart_apply(obj);
343} 343}
344 344
345void
346termio_scroll_top_backlog(Evas_Object *obj)
347{
348 Termio *sd = evas_object_smart_data_get(obj);
349 EINA_SAFETY_ON_NULL_RETURN(sd);
350 sd->scroll = INT32_MAX;
351 _remove_links(sd, obj);
352 _smart_apply(obj);
353}
354
345const char * 355const char *
346termio_title_get(Evas_Object *obj) 356termio_title_get(Evas_Object *obj)
347{ 357{
diff --git a/src/bin/termio.h b/src/bin/termio.h
index 3b660e9..0567de6 100644
--- a/src/bin/termio.h
+++ b/src/bin/termio.h
@@ -14,6 +14,7 @@ char *termio_selection_get(Evas_Object *obj,
14 int c1x, int c1y, int c2x, int c2y, 14 int c1x, int c1y, int c2x, int c2y,
15 size_t *len, Eina_Bool right_trim); 15 size_t *len, Eina_Bool right_trim);
16Eina_Bool termio_selection_exists(const Evas_Object *obj); 16Eina_Bool termio_selection_exists(const Evas_Object *obj);
17void termio_scroll_top_backlog(Evas_Object *obj);
17void termio_scroll_delta(Evas_Object *obj, int delta, int by_page); 18void termio_scroll_delta(Evas_Object *obj, int delta, int by_page);
18void termio_scroll_set(Evas_Object *obj, int scroll); 19void termio_scroll_set(Evas_Object *obj, int scroll);
19void termio_scroll(Evas_Object *obj, int direction, int start_y, int end_y); 20void termio_scroll(Evas_Object *obj, int direction, int start_y, int end_y);