From 823057f4b3ca7e63b599e3812d41566b8313ca67 Mon Sep 17 00:00:00 2001 From: Dominik Vogt Date: Thu, 20 Mar 2008 11:23:26 +0100 Subject: [PATCH] New actions toggle-date, toggle-author, and toggle-refs. Signed-off-by: Dominik Vogt Signed-off-by: Jonas Fonseca --- manual.txt | 3 +++ tig.c | 30 +++++++++++++++++++++++++++--- tigrc.5.txt | 3 +++ 3 files changed, 33 insertions(+), 3 deletions(-) diff --git a/manual.txt b/manual.txt index ca01561..fd466db 100644 --- a/manual.txt +++ b/manual.txt @@ -347,7 +347,10 @@ z Stop all background loading. This can be useful if you use \ the revision log. v Show version. '.' Toggle line numbers on/off. +D Toggle date display on/off. +A Toggle author display on/off. g Toggle revision graph visualization on/off. +F Toggle reference display on/off (tag and branch names). ':' Open prompt. This allows you to specify what git command \ to run. Example `:log -p` u Update status of file. In the status view, this allows you to add an \ diff --git a/tig.c b/tig.c index 73aa991..6cfe40e 100644 --- a/tig.c +++ b/tig.c @@ -354,7 +354,10 @@ sq_quote(char buf[SIZEOF_STR], size_t bufsize, const char *src) REQ_(SHOW_VERSION, "Show version information"), \ REQ_(STOP_LOADING, "Stop all loading views"), \ REQ_(TOGGLE_LINENO, "Toggle line numbers"), \ + REQ_(TOGGLE_DATE, "Toggle date display"), \ + REQ_(TOGGLE_AUTHOR, "Toggle author display"), \ REQ_(TOGGLE_REV_GRAPH, "Toggle revision graph visualization"), \ + REQ_(TOGGLE_REFS, "Toggle reference display (tags/branches)"), \ REQ_(STATUS_UPDATE, "Update file status"), \ REQ_(STATUS_MERGE, "Merge file using external tool"), \ REQ_(TREE_PARENT, "Switch to parent directory in tree view"), \ @@ -422,8 +425,11 @@ static const char usage[] = " -h, --help Show help message and exit\n"; /* Option and state variables. */ +static bool opt_date = TRUE; +static bool opt_author = TRUE; static bool opt_line_number = FALSE; static bool opt_rev_graph = FALSE; +static bool opt_show_refs = TRUE; static int opt_num_interval = NUMBER_INTERVAL; static int opt_tab_size = TABSIZE; static enum request opt_request = REQ_VIEW_MAIN; @@ -808,7 +814,10 @@ static struct keybinding default_keybindings[] = { { 'v', REQ_SHOW_VERSION }, { 'r', REQ_SCREEN_REDRAW }, { '.', REQ_TOGGLE_LINENO }, + { 'D', REQ_TOGGLE_DATE }, + { 'A', REQ_TOGGLE_AUTHOR }, { 'g', REQ_TOGGLE_REV_GRAPH }, + { 'F', REQ_TOGGLE_REFS }, { ':', REQ_PROMPT }, { 'u', REQ_STATUS_UPDATE }, { 'M', REQ_STATUS_MERGE }, @@ -2540,11 +2549,26 @@ view_driver(struct view *view, enum request request) redraw_display(); break; + case REQ_TOGGLE_DATE: + opt_date = !opt_date; + redraw_display(); + break; + + case REQ_TOGGLE_AUTHOR: + opt_author = !opt_author; + redraw_display(); + break; + case REQ_TOGGLE_REV_GRAPH: opt_rev_graph = !opt_rev_graph; redraw_display(); break; + case REQ_TOGGLE_REFS: + opt_show_refs = !opt_show_refs; + redraw_display(); + break; + case REQ_PROMPT: /* Always reload^Wrerun commands from the prompt. */ open_view(view, opt_request, OPEN_RELOAD); @@ -4175,7 +4199,7 @@ main_draw(struct view *view, struct line *line, unsigned int lineno, bool select tilde_attr = get_line_attr(LINE_MAIN_DELIM); } - { + if (opt_date) { int n; timelen = strftime(buf, sizeof(buf), DATE_FORMAT, &commit->time); @@ -4193,7 +4217,7 @@ main_draw(struct view *view, struct line *line, unsigned int lineno, bool select if (type != LINE_CURSOR) wattrset(view->win, get_line_attr(LINE_MAIN_AUTHOR)); - { + if (opt_author) { int max_len; max_len = view->width - col; @@ -4230,7 +4254,7 @@ main_draw(struct view *view, struct line *line, unsigned int lineno, bool select wmove(view->win, lineno, col); - if (commit->refs) { + if (opt_show_refs && commit->refs) { size_t i = 0; do { diff --git a/tigrc.5.txt b/tigrc.5.txt index f7d7bed..c974efc 100644 --- a/tigrc.5.txt +++ b/tigrc.5.txt @@ -243,7 +243,10 @@ screen-resize Resize the screen show-version Show version information stop-loading Stop all loading views toggle-lineno Toggle line numbers +toggle-date Toggle date display +toggle-author Toggle author display toggle-rev-graph Toggle revision graph visualization +toggle-refs Toggle reference display status-update Update file status status-merge Resolve unmerged file tree-parent Switch to parent directory in tree view -- 2.11.0