Skip to content

Commit

Permalink
Jump to line when a number is entered in the prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
jonas committed Feb 7, 2009
1 parent 96c65b4 commit 06d4108
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Improvements:
- Status view: improve "on branch" information inspired by the prompt
code in git's bash completion script.
- Colors for 256-capable terminals can be specified as colorN.
- Entering a number in the prompt will jump to that line number.

tig-0.14
--------
Expand Down
12 changes: 11 additions & 1 deletion tig.c
Original file line number Diff line number Diff line change
Expand Up @@ -6943,7 +6943,17 @@ main(int argc, const char *argv[])
{
char *cmd = read_prompt(":");

if (cmd) {
if (cmd && isdigit(*cmd)) {
int lineno = view->lineno + 1;

if (parse_int(&lineno, cmd, 1, view->lines + 1) == OK) {
select_view_line(view, lineno - 1);
report("");
} else {
report("Unable to parse '%s' as a line number", cmd);
}

} else if (cmd) {
struct view *next = VIEW(REQ_VIEW_PAGER);
const char *argv[SIZEOF_ARG] = { "git" };
int argc = 1;
Expand Down

0 comments on commit 06d4108

Please sign in to comment.