Code

Merge with master
authorJonas Fonseca <fonseca@diku.dk>
Mon, 30 Oct 2006 02:16:42 +0000 (03:16 +0100)
committerJonas Fonseca <fonseca@diku.dk>
Mon, 30 Oct 2006 02:16:42 +0000 (03:16 +0100)
BUGS
INSTALL
SITES
TODO
manual.txt
tig.1.txt
tig.c
tigrc.5.txt

diff --git a/BUGS b/BUGS
index 0783a2eb80ad2ca70472c275fc3a02c948709ed9..35c834450a11067d21b47254308757514f5f9643 100644 (file)
--- a/BUGS
+++ b/BUGS
@@ -2,4 +2,6 @@ BUGS
 ----
 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.
diff --git a/INSTALL b/INSTALL
index dac48a4e184ab08be2258a5ec99aca896d9f589f..088f6742c41683e63daa04417a66048d5bd340e4 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -14,6 +14,11 @@ To install documentation run:
 
        $ 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:
 
 `-------------------------------`----------------------------------------------
@@ -23,5 +28,8 @@ git-core                      Tig is just a frontend for git.
 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)
 -------------------------------------------------------------------------------
diff --git a/SITES b/SITES
index 25e94dc757390bd7c4882cbd396d7c3cf3776999..500b9770772df2b5e8fccf28746176044f12c192 100644 (file)
--- a/SITES
+++ b/SITES
@@ -1,5 +1,6 @@
- - 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[]
diff --git a/TODO b/TODO
index 316f2750c5479a6089d94aa433690b1dba565acb..f36da733e21ab36b252fce1b9dfe1a8817e5e081 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1,8 +1,18 @@
 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
index 64afe2a009c5a646edc6c63cc2c177da966445af..2a12b99418a83b92bcf3fd4e3717a2bf58cb9c4a 100644 (file)
@@ -120,6 +120,19 @@ TIG_MAIN_CMD::
        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
 ----------
@@ -144,7 +157,7 @@ Current Head and Commit ID
 ~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 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.
 
@@ -245,7 +258,7 @@ Enter       This key is "context sensitive" depending on what view you are \
        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.
@@ -319,7 +332,7 @@ Revision Specification
 
 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).
 
index 94fa5a38772d14136b39d73187cd67e14921f9fc..4b8a73529b1054c71b11510d39577158cd752d9b 100644 (file)
--- a/tig.1.txt
+++ b/tig.1.txt
@@ -110,7 +110,7 @@ FILES
        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[]
diff --git a/tig.c b/tig.c
index 1e033c607d041bbec20f272598dca9a6f4d6ef15..1983375ca03a517a6d1408b2488c8814cc4d5a31 100644 (file)
--- a/tig.c
+++ b/tig.c
@@ -12,7 +12,7 @@
  */
 
 #ifndef        VERSION
-#define VERSION        "tig-0.4.git"
+#define VERSION        "tig-0.5.git"
 #endif
 
 #ifndef DEBUG
@@ -460,6 +460,17 @@ parse_options(int argc, char *argv[])
        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;
@@ -495,17 +506,6 @@ parse_options(int argc, char *argv[])
                        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);
        }
 
@@ -739,9 +739,6 @@ static struct keybinding default_keybindings[] = {
        { '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 },
 };
@@ -1173,6 +1170,9 @@ struct view_ops;
 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++)
 
@@ -1310,7 +1310,10 @@ redraw_view_from(struct view *view, int lineno)
        }
 
        redrawwin(view->win);
-       wrefresh(view->win);
+       if (input_mode)
+               wnoutrefresh(view->win);
+       else
+               wrefresh(view->win);
 }
 
 static void
@@ -1370,10 +1373,14 @@ update_view_title(struct view *view)
        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
@@ -1876,7 +1883,7 @@ update_view(struct view *view)
 
                        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);
@@ -2586,7 +2593,7 @@ tree_read(struct view *view, char *text)
 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) {
@@ -2616,11 +2623,12 @@ tree_enter(struct view *view, struct line *line)
 
                /* 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;
 
@@ -2689,7 +2697,7 @@ static struct view_ops blob_ops = {
 
 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. */
@@ -3104,13 +3112,19 @@ main_read(struct view *view, char *line)
 
                /* 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;
@@ -3345,26 +3359,30 @@ static bool cursed = FALSE;
 /* 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);
@@ -3434,10 +3452,16 @@ read_prompt(const char *prompt)
                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) {
@@ -3472,11 +3496,12 @@ read_prompt(const char *prompt)
                }
        }
 
-       if (status == CANCEL) {
-               /* Clear the status window */
-               report("");
+       /* Clear the status window */
+       status_empty = FALSE;
+       report("");
+
+       if (status == CANCEL)
                return NULL;
-       }
 
        buf[pos++] = 0;
 
@@ -3735,6 +3760,13 @@ main(int argc, char *argv[])
                /* 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
index 7c49c59c086d1db219f5d1b93b5715543dbcd8fb..1b1df676c65f2e3fbee7d480f3ab65a6ed91faf7 100644 (file)
@@ -70,7 +70,7 @@ The following variables can be set:
 
 '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)::
@@ -116,7 +116,7 @@ Examples:
 
 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.
 
 --
@@ -157,8 +157,10 @@ View switching:
 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[]
@@ -183,10 +185,10 @@ Cursor navigation:
 ------------------------------------------------------------------------------
 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[]
@@ -195,10 +197,10 @@ 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[]
@@ -214,7 +216,7 @@ screen-resize               Resize the screen
 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
 ------------------------------------------------------------------------------
 
 
@@ -223,7 +225,7 @@ Color command
 
 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]
@@ -277,7 +279,7 @@ Appearance of the bottom window showing info messages.
 
 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*
@@ -323,7 +325,7 @@ Pretty print commit headers::
 
 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*