----
Known bugs and problems:
- - In it's current state tig is pretty much UTF-8 only.
+ - Proper locale support: in it's current state tig is pretty much UTF-8 only.
+
+ - Horizontal scrolling.
$ make install-docs
+Edit the Makefile if you need to configure specific compiler or linker flags.
+On FreeBSD for example the c library does not support the iconv interface and
+to compile tig you need to append `-L/usr/local/lib -liconv` to `LDLIBS` and
+`-I/usr/local/include` to the `CFLAGS` variable.
+
The following tools and packages are needed:
`-------------------------------`----------------------------------------------
ncurses Be sure to also have development files \
installed. Usually they are available in a \
separate package ending with `-dev`.
+iconv If iconv is not provided by the c library \
+ you need to change the Makefile to link it \
+ into the binary.
asciidoc (>= 7.0), xmlto For building documentation. (Optional)
-------------------------------------------------------------------------------
- - Homepage: http://jonas.nitro.dk/tig[]
- - Manual: http://jonas.nitro.dk/tig/manual.html[]
- - Releases: http://jonas.nitro.dk/tig/releases[]
- - Git URL: http://jonas.nitro.dk/tig/tig.git[]
- - Gitweb: http://pasky.or.cz/gitweb.cgi?p=tig.git;a=summary[]
+ - Homepage: http://jonas.nitro.dk/tig[]
+ - Manual: http://jonas.nitro.dk/tig/manual.html[]
+ - Releases: http://jonas.nitro.dk/tig/releases[]
+ - Git URL: http://jonas.nitro.dk/tig/tig.git[] or
+ git://repo.or.cz/tig.git
+ - Gitweb: http://repo.or.cz/?p=tig.git;a=summary[]
TODO
----
Features that should be explored.
-
- - Locale support.
+
+ - Repository status view.
+
+ - Better text-input support. From setsyx(3):
+
+ The setsyx routine sets the virtual screen cursor to y, x. If y and x
+ are both -1, then leaveok is set. The two routines getsyx and setsyx
+ are designed to be used by a library routine, which manipulates
+ curses windows but does not want to change the current position of the
+ program’s cursor. The library routine would call getsyx at the
+ beginning, do its manipulation of its own windows, do a wnoutrefresh on
+ its windows, call setsyx, and then call doupdate.
- When the user wants to "view" a commit, you could show from which branch
heads and from which tags the commit is reachable, and perhaps which tag is
the option: `--pretty=raw` since the main view parser expects to
read that format.
+[[tree-commands]]
+Tree Commands
+~~~~~~~~~~~~~
+
+TIG_TREE_CMD::
+ The command used for the tree view. Takes two arguments, the first
+ is the revision ID and the second is the path of the directory tree,
+ empty for the root directory. Defaults to "git ls-tree %s %s".
+
+TIG_BLOB_CMD::
+ The command used for the blob view. Takes one argument which is
+ the blob ID. Defaults to "git cat-file blob %s".
+
[[viewer]]
The Viewer
----------
~~~~~~~~~~~~~~~~~~~~~~~~~~
The viewer keeps track of both what head and commit ID you are currently
-viewing. The commit ID will follow the cursor line and change everytime time
+viewing. The commit ID will follow the cursor line and change every time
you highlight a different commit. Whenever you reopen the diff view it will be
reloaded, if the commit ID changed.
pressing Enter will simply scroll the view one line down.
Tab Switch to next view.
Up This key is "context sensitive" and will move the cursor one \
- line up. However, uf you opened a diff view from the main view \
+ line up. However, if you opened a diff view from the main view \
(split- or full-screen) it will change the cursor to point to \
the previous commit in the main view and update the diff view \
to display it.
This section describes various ways to specify what revisions to display or
otherwise limit the view to. Tig does not itself parse the described
-revision options so refer to the relevant git man pages for futher
+revision options so refer to the relevant git man pages for further
information. Relevant man pages besides git-log(1) are git-diff(1) and
git-rev-list(1).
User configuration file. See gitlink:tigrc[5] for examples.
'.git/config'::
- Repository config file. Read on startup with the help of
+ Repository config file. Read on start-up with the help of
git-repo-config(1).
include::BUGS[]
*/
#ifndef VERSION
-#define VERSION "tig-0.4.git"
+#define VERSION "tig-0.5.git"
#endif
#ifndef DEBUG
for (i = 1; i < argc; i++) {
char *opt = argv[i];
+ if (!strcmp(opt, "log") ||
+ !strcmp(opt, "diff") ||
+ !strcmp(opt, "show")) {
+ opt_request = opt[0] == 'l'
+ ? REQ_VIEW_LOG : REQ_VIEW_DIFF;
+ break;
+ }
+
+ if (opt[0] && opt[0] != '-')
+ break;
+
if (!strcmp(opt, "-l")) {
opt_request = REQ_VIEW_LOG;
continue;
break;
}
- if (!strcmp(opt, "log") ||
- !strcmp(opt, "diff") ||
- !strcmp(opt, "show")) {
- opt_request = opt[0] == 'l'
- ? REQ_VIEW_LOG : REQ_VIEW_DIFF;
- break;
- }
-
- if (opt[0] && opt[0] != '-')
- break;
-
die("unknown option '%s'\n\n%s", opt, usage);
}
{ 'g', REQ_TOGGLE_REV_GRAPH },
{ ':', REQ_PROMPT },
- /* wgetch() with nodelay() enabled returns ERR when there's no input. */
- { ERR, REQ_NONE },
-
/* Using the ncurses SIGWINCH handler. */
{ KEY_RESIZE, REQ_SCREEN_RESIZE },
};
static struct view *display[2];
static unsigned int current_view;
+/* Reading from the prompt? */
+static bool input_mode = FALSE;
+
#define foreach_displayed_view(view, i) \
for (i = 0; i < ARRAY_SIZE(display) && (view = display[i]); i++)
}
redrawwin(view->win);
- wrefresh(view->win);
+ if (input_mode)
+ wnoutrefresh(view->win);
+ else
+ wrefresh(view->win);
}
static void
else
wbkgdset(view->title, get_line_attr(LINE_TITLE_BLUR));
- werase(view->title);
mvwaddnstr(view->title, 0, 0, buf, bufpos);
+ wclrtoeol(view->title);
wmove(view->title, 0, view->width - 1);
- wrefresh(view->title);
+
+ if (input_mode)
+ wnoutrefresh(view->title);
+ else
+ wrefresh(view->title);
}
static void
size_t ret;
- ret = iconv(opt_iconv, &inbuf, &inlen, &outbuf, &outlen);
+ ret = iconv(opt_iconv, (const char **) &inbuf, &inlen, &outbuf, &outlen);
if (ret != (size_t) -1) {
line = out_buffer;
linelen = strlen(out_buffer);
static bool
tree_enter(struct view *view, struct line *line)
{
- enum open_flags flags = display[0] == view ? OPEN_SPLIT : OPEN_DEFAULT;
+ enum open_flags flags;
enum request request;
switch (line->type) {
/* Trees and subtrees share the same ID, so they are not not
* unique like blobs. */
- flags |= OPEN_RELOAD;
+ flags = OPEN_RELOAD;
request = REQ_VIEW_TREE;
break;
case LINE_TREE_FILE:
+ flags = display[0] == view ? OPEN_SPLIT : OPEN_DEFAULT;
request = REQ_VIEW_BLOB;
break;
struct commit {
char id[SIZEOF_REV]; /* SHA1 ID. */
- char title[75]; /* First line of the commit message. */
+ char title[128]; /* First line of the commit message. */
char author[75]; /* Author of the commit. */
struct tm time; /* Date from the author ident. */
struct ref **refs; /* Repository references. */
/* Require titles to start with a non-space character at the
* offset used by git log. */
- /* FIXME: More gracefull handling of titles; append "..." to
- * shortened titles, etc. */
- if (strncmp(line, " ", 4) ||
- isspace(line[4]))
+ if (strncmp(line, " ", 4))
+ break;
+ line += 4;
+ /* Well, if the title starts with a whitespace character,
+ * try to be forgiving. Otherwise we end up with no title. */
+ while (isspace(*line))
+ line++;
+ if (*line == '\0')
break;
+ /* FIXME: More graceful handling of titles; append "..." to
+ * shortened titles, etc. */
- string_copy(commit->title, line + 4);
+ string_copy(commit->title, line);
}
return TRUE;
/* The status window is used for polling keystrokes. */
static WINDOW *status_win;
+static bool status_empty = TRUE;
+
/* Update status and title window. */
static void
report(const char *msg, ...)
{
- static bool empty = TRUE;
struct view *view = display[current_view];
- if (!empty || *msg) {
+ if (input_mode)
+ return;
+
+ if (!status_empty || *msg) {
va_list args;
va_start(args, msg);
- werase(status_win);
wmove(status_win, 0, 0);
if (*msg) {
vwprintw(status_win, msg, args);
- empty = FALSE;
+ status_empty = FALSE;
} else {
- empty = TRUE;
+ status_empty = TRUE;
}
+ wclrtoeol(status_win);
wrefresh(status_win);
va_end(args);
struct view *view;
int i, key;
+ input_mode = TRUE;
+
foreach_view (view, i)
update_view(view);
- report("%s%.*s", prompt, pos, buf);
+ input_mode = FALSE;
+
+ mvwprintw(status_win, 0, 0, "%s%.*s", prompt, pos, buf);
+ wclrtoeol(status_win);
+
/* Refresh, accept single keystroke of input */
key = wgetch(status_win);
switch (key) {
}
}
- if (status == CANCEL) {
- /* Clear the status window */
- report("");
+ /* Clear the status window */
+ status_empty = FALSE;
+ report("");
+
+ if (status == CANCEL)
return NULL;
- }
buf[pos++] = 0;
/* Refresh, accept single keystroke of input */
key = wgetch(status_win);
+ /* wgetch() with nodelay() enabled returns ERR when there's no
+ * input. */
+ if (key == ERR) {
+ request = REQ_NONE;
+ continue;
+ }
+
request = get_keybinding(display[current_view]->keymap, key);
/* Some low-level request handling. This keeps access to
'show-rev-graph' (bool)::
- Show revision graph in the main view on startup. Can be toggled with
+ Show revision graph in the main view on start-up. Can be toggled with
'g'.
'line-number-interval' (int)::
Keys are mapped by first searching the keybindings for the current view, then
the keybindings for the *generic* keymap, and last the default keybindings.
-Thus, the view keybindings shaddow the generic keybindings which shaddow the
+Thus, the view keybindings shadow the generic keybindings which Shadow the
built-in keybindings.
--
view-main Show main view
view-diff Show diff view
view-log Show log view
-view-help Show help page
+view-tree Show tree view
+view-blob Show blob view
view-pager Show pager view
+view-help Show help page
------------------------------------------------------------------------------
ifdef::backend-xhtml11[]
------------------------------------------------------------------------------
move-up Move cursor one line up
move-down Move cursor one line down
-move-page_down Move cursor one page down
-move-page_up Move cursor one page up
-move-first_line Move cursor to first line
-move-last_line Move cursor to last line
+move-page-down Move cursor one page down
+move-page-up Move cursor one page up
+move-first-line Move cursor to first line
+move-last-line Move cursor to last line
------------------------------------------------------------------------------
ifdef::backend-xhtml11[]
endif::backend-xhtml11[]
Scrolling:
------------------------------------------------------------------------------
-scroll-line_up Scroll one line up
-scroll-line_down Scroll one line down
-scroll-page_up Scroll one page up
-scroll-page_down Scroll one page down
+scroll-line-up Scroll one line up
+scroll-line-down Scroll one line down
+scroll-page-eup Scroll one page up
+scroll-page-down Scroll one page down
------------------------------------------------------------------------------
ifdef::backend-xhtml11[]
show-version Show version information
stop-loading Stop all loading views
toggle-lineno Toggle line numbers
-toggle-rev_graph Toggle revision graph visualization
+toggle-rev-graph Toggle revision graph visualization
------------------------------------------------------------------------------
Color commands control highlighting and the user interface styles. If your
terminal supports color, these commands can be used to assign foreground and
-backgound combinations to certain areas. Optionally, an attribute can be given
+background combinations to certain areas. Optionally, an attribute can be given
as the last parameter. The syntax is:
[verse]
Title window colors::
-Appearence of the title windows when they are attached
+Appearance of the title windows when they are attached
to any backgrounded windows and the current window.
*title-blur*, *title-focus*
Commit diffs and the revision logs are usually formatted using pretty printed
headers , unless `--pretty=raw` was given. This includes lines, such as merge
-info, commit ID, and author and comitter date.
+info, commit ID, and author and committer date.
*pp-author*, *pp-commit*, *pp-merge*, *pp-date*, *pp-adate*, *pp-cdate*