summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1e69632)
raw | patch | inline | side by side (parent: 1e69632)
author | Samuel Bronson <naesten@gmail.com> | |
Wed, 12 Aug 2009 22:11:55 +0000 (18:11 -0400) | ||
committer | Samuel Bronson <naesten@gmail.com> | |
Wed, 12 Aug 2009 22:11:55 +0000 (18:11 -0400) |
Signed-off-by: Samuel Bronson <naesten@gmail.com>
tig.c | patch | blob | history | |
tigrc.5.txt | patch | blob | history |
index e52185e4be36b0f15174ff2faad7e2c50196c933..55e022468ee15d7add89caa417d6b5b811a66caa 100644 (file)
--- a/tig.c
+++ b/tig.c
@@ -103,6 +103,7 @@ static size_t utf8_length(const char **string, size_t col, int *width, size_t ma
/* The format and size of the date column in the main view. */
#define DATE_FORMAT "%Y-%m-%d %H:%M"
#define DATE_COLS STRING_SIZE("2006-04-29 14:21 ")
+#define DATE_SHORT_COLS STRING_SIZE("2006-04-29 ")
#define ID_COLS 8
REQ_(OPTIONS, "Open option menu"), \
REQ_(TOGGLE_LINENO, "Toggle line numbers"), \
REQ_(TOGGLE_DATE, "Toggle date display"), \
+ REQ_(TOGGLE_DATE_SHORT, "Toggle short (date-only) dates"), \
REQ_(TOGGLE_AUTHOR, "Toggle author display"), \
REQ_(TOGGLE_REV_GRAPH, "Toggle revision graph visualization"), \
REQ_(TOGGLE_REFS, "Toggle reference display (tags/branches)"), \
/* Option and state variables. */
static bool opt_date = TRUE;
+static bool opt_date_short = FALSE;
static bool opt_author = TRUE;
static bool opt_line_number = FALSE;
static bool opt_line_graphics = TRUE;
{ 'o', REQ_OPTIONS },
{ '.', REQ_TOGGLE_LINENO },
{ 'D', REQ_TOGGLE_DATE },
+ { 'T', REQ_TOGGLE_DATE_SHORT },
{ 'A', REQ_TOGGLE_AUTHOR },
{ 'g', REQ_TOGGLE_REV_GRAPH },
{ 'F', REQ_TOGGLE_REFS },
if (!strcmp(argv[0], "show-date"))
return parse_bool(&opt_date, argv[2]);
+ if (!strcmp(argv[0], "date-short"))
+ return parse_bool(&opt_date_short, argv[2]);
+
if (!strcmp(argv[0], "show-rev-graph"))
return parse_bool(&opt_rev_graph, argv[2]);
draw_date(struct view *view, time_t *time)
{
const char *date = mkdate(time);
+ int cols = opt_date_short ? DATE_SHORT_COLS : DATE_COLS;
- return draw_field(view, LINE_DATE, date, DATE_COLS, FALSE);
+ return draw_field(view, LINE_DATE, date, cols, FALSE);
}
static bool
toggle_view_option(&opt_date, "date display");
break;
+ case REQ_TOGGLE_DATE_SHORT:
+ toggle_view_option(&opt_date_short, "date shortening");
+ break;
+
case REQ_TOGGLE_AUTHOR:
toggle_view_option(&opt_author, "author display");
break;
diff --git a/tigrc.5.txt b/tigrc.5.txt
index 1376232bd90e23902b575251db6278c3e28c42bf..618761d91014662dc8c6192933cdb9d4289993e2 100644 (file)
--- a/tigrc.5.txt
+++ b/tigrc.5.txt
(branches, tags, and remotes) in the main view on start-up. Can all be
toggled.
+'date-short' (bool)::
+
+ Whether to shorten the date column in the main view to just the date
+ on startup. Can be toggled.
+
'author-width' (int)::
Width of the author column. When set to 5 or below, the author name
options Open options menu
toggle-lineno Toggle line numbers
toggle-date Toggle date display
+toggle-date-short Toggle short (date-only) dates
toggle-author Toggle author display
toggle-rev-graph Toggle revision graph visualization
toggle-refs Toggle reference display