From e6d4219625f469c6f5cd6b817a50121b157d6b68 Mon Sep 17 00:00:00 2001 From: Rodolfo Borges Date: Thu, 15 May 2008 18:37:37 -0300 Subject: [PATCH] Add option 'author-width' to consumize the width of the author column This can be used when the first few characteres are enough to tell the authors apart or when the default width is too narrow. To set the width of the author column to 10 put the following in the ~/.tigrc file: set author-width = 10 --- NEWS | 2 ++ tig.c | 10 ++++++++-- tigrc.5.txt | 5 +++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index fcaa853..b7a8df1 100644 --- a/NEWS +++ b/NEWS @@ -12,6 +12,8 @@ Improvements: - Stage view: add stage-next action to jump to next diff chunk that can be staged. By default bound to '@'. - Configure: check for the ncurses header files. + - Add author-width option to costumize the width of the author column. + For example, put the following in ~/.tigrc: set author-width = 10 Bug fixes: diff --git a/tig.c b/tig.c index 3802204..8679025 100644 --- a/tig.c +++ b/tig.c @@ -451,6 +451,7 @@ static bool opt_rev_graph = FALSE; static bool opt_show_refs = TRUE; static int opt_num_interval = NUMBER_INTERVAL; static int opt_tab_size = TAB_SIZE; +static int opt_author_cols = AUTHOR_COLS-1; static enum request opt_request = REQ_VIEW_MAIN; static char opt_cmd[SIZEOF_STR] = ""; static char opt_path[SIZEOF_STR] = ""; @@ -1149,6 +1150,11 @@ option_set_command(int argc, char *argv[]) return OK; } + if (!strcmp(argv[0], "author-width")) { + opt_author_cols = atoi(argv[2]); + return OK; + } + if (!strcmp(argv[0], "tab-size")) { opt_tab_size = atoi(argv[2]); return OK; @@ -3677,7 +3683,7 @@ blame_draw(struct view *view, struct line *line, unsigned int lineno) return TRUE; if (opt_author && - draw_field(view, LINE_MAIN_AUTHOR, author, AUTHOR_COLS, TRUE)) + draw_field(view, LINE_MAIN_AUTHOR, author, opt_author_cols, TRUE)) return TRUE; if (draw_field(view, LINE_BLAME_ID, id, ID_COLS, FALSE)) @@ -4929,7 +4935,7 @@ main_draw(struct view *view, struct line *line, unsigned int lineno) return TRUE; if (opt_author && - draw_field(view, LINE_MAIN_AUTHOR, commit->author, AUTHOR_COLS, TRUE)) + draw_field(view, LINE_MAIN_AUTHOR, commit->author, opt_author_cols, TRUE)) return TRUE; if (opt_rev_graph && commit->graph_size && diff --git a/tigrc.5.txt b/tigrc.5.txt index 00fd186..471aab3 100644 --- a/tigrc.5.txt +++ b/tigrc.5.txt @@ -47,6 +47,7 @@ set show-date = yes # Show commit date? set show-rev-graph = yes # Show revision graph? set show-refs = yes # Show references? set show-line-numbers = no # Show line numbers? +set author-width = 10 # Set width of the author column set line-graphics = no # Disable graphics characters set line-number-interval = 5 # Interval between line numbers set tab-size = 8 # Number of spaces per tab @@ -82,6 +83,10 @@ The following variables can be set: (branches, tags, and remotes) in the main view on start-up. Can all be toggled. +'author-width' (int):: + + Width of the author column. + 'line-graphics' (bool):: Whether to use graphic characters for line drawing. -- 2.32.0.93.g670b81a890