chiark
/
gitweb
/
~mdw
/
tig
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
20f4b4a
)
Move the current line to the first entry in the tree view
author
Jonas Fonseca
<fonseca@diku.dk>
Sun, 10 Sep 2006 23:32:05 +0000
(
01:32
+0200)
committer
Jonas Fonseca
<fonseca@antimatter.localdomain>
Sun, 10 Sep 2006 23:32:05 +0000
(
01:32
+0200)
tig.c
patch
|
blob
|
blame
|
history
diff --git
a/tig.c
b/tig.c
index df2ede1b60e2074b0c95979a0664e72ecf71acb6..bd868994f1e299c7e279f166733f02da3f56d037 100644
(file)
--- a/
tig.c
+++ b/
tig.c
@@
-2452,6
+2452,7
@@
tree_read(struct view *view, char *text)
char buf[SIZEOF_STR];
unsigned long pos;
enum line_type type;
char buf[SIZEOF_STR];
unsigned long pos;
enum line_type type;
+ bool first_read = view->lines == 0;
if (textlen <= SIZEOF_TREE_ATTR)
return FALSE;
if (textlen <= SIZEOF_TREE_ATTR)
return FALSE;
@@
-2459,8
+2460,7
@@
tree_read(struct view *view, char *text)
type = text[STRING_SIZE("100644 ")] == 't'
? LINE_TREE_DIR : LINE_TREE_FILE;
type = text[STRING_SIZE("100644 ")] == 't'
? LINE_TREE_DIR : LINE_TREE_FILE;
- /* The first time around ... */
- if (!view->lines) {
+ if (first_read) {
/* Add path info line */
if (snprintf(buf, sizeof(buf), "Directory path /%s", opt_path) < sizeof(buf) &&
realloc_lines(view, view->line_size + 1) &&
/* Add path info line */
if (snprintf(buf, sizeof(buf), "Directory path /%s", opt_path) < sizeof(buf) &&
realloc_lines(view, view->line_size + 1) &&
@@
-2518,6
+2518,10
@@
tree_read(struct view *view, char *text)
if (!pager_read(view, text))
return FALSE;
if (!pager_read(view, text))
return FALSE;
+ /* Move the current line to the first tree entry. */
+ if (first_read)
+ view->lineno++;
+
view->line[view->lines - 1].type = type;
return TRUE;
}
view->line[view->lines - 1].type = type;
return TRUE;
}