~mdw
/
tig
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
update_display_cursor: take view as arg
[tig]
/
tig.c
diff --git
a/tig.c
b/tig.c
index
6236bf3
..
1a5ed4a
100644
(file)
--- a/
tig.c
+++ b/
tig.c
@@
-59,6
+59,7
@@
static size_t utf8_length(const char *string, size_t max_width, int *coloffset,
#define SIZEOF_STR 1024 /* Default string size. */
#define SIZEOF_REF 256 /* Size of symbolic or SHA1 ID. */
#define SIZEOF_STR 1024 /* Default string size. */
#define SIZEOF_REF 256 /* Size of symbolic or SHA1 ID. */
+#define SIZEOF_REV 41 /* Holds a SHA-1 and an ending NUL */
#define SIZEOF_REVGRAPH 19 /* Size of revision ancestry graphics. */
/* This color name can be used to refer to the default term colors. */
#define SIZEOF_REVGRAPH 19 /* Size of revision ancestry graphics. */
/* This color name can be used to refer to the default term colors. */
@@
-109,7
+110,7
@@
static size_t utf8_length(const char *string, size_t max_width, int *coloffset,
struct ref {
char *name; /* Ref name; tag or head names are shortened. */
struct ref {
char *name; /* Ref name; tag or head names are shortened. */
- char id[
41];
/* Commit SHA1 ID */
+ char id[
SIZEOF_REV];
/* Commit SHA1 ID */
unsigned int tag:1; /* Is it a tag? */
unsigned int next:1; /* For ref lists: are there more refs? */
};
unsigned int tag:1; /* Is it a tag? */
unsigned int next:1; /* For ref lists: are there more refs? */
};
@@
-1413,10
+1414,8
@@
redraw_display(void)
}
static void
}
static void
-update_display_cursor(
void
)
+update_display_cursor(
struct view *view
)
{
{
- struct view *view = display[current_view];
-
/* Move the cursor to the right-most column of the cursor line.
*
* XXX: This could turn out to be a bit expensive, but it ensures that
/* Move the cursor to the right-most column of the cursor line.
*
* XXX: This could turn out to be a bit expensive, but it ensures that
@@
-2447,7
+2446,7
@@
static struct view_ops pager_ops = {
* Tree backend
*/
* Tree backend
*/
-/* Parse output from git
ls-tree
:
+/* Parse output from git
-ls-tree(1)
:
*
* 100644 blob fb0e31ea6cc679b7379631188190e975f5789c26 Makefile
* 100644 blob 5304ca4260aaddaee6498f9630e7d471b8591ea6 README
*
* 100644 blob fb0e31ea6cc679b7379631188190e975f5789c26 Makefile
* 100644 blob 5304ca4260aaddaee6498f9630e7d471b8591ea6 README
@@
-2558,7
+2557,6
@@
static bool
tree_enter(struct view *view, struct line *line)
{
enum open_flags flags = display[0] == view ? OPEN_SPLIT : OPEN_DEFAULT;
tree_enter(struct view *view, struct line *line)
{
enum open_flags flags = display[0] == view ? OPEN_SPLIT : OPEN_DEFAULT;
- char *data = line->data;
enum request request;
switch (line->type) {
enum request request;
switch (line->type) {
@@
-2577,6
+2575,7
@@
tree_enter(struct view *view, struct line *line)
} else {
size_t pathlen = strlen(opt_path);
size_t origlen = pathlen;
} else {
size_t pathlen = strlen(opt_path);
size_t origlen = pathlen;
+ char *data = line->data;
char *basename = data + SIZEOF_TREE_ATTR;
if (!string_format_from(opt_path, &pathlen, "%s/", basename)) {
char *basename = data + SIZEOF_TREE_ATTR;
if (!string_format_from(opt_path, &pathlen, "%s/", basename)) {
@@
-2617,9
+2616,11
@@
tree_select(struct view *view, struct line *line)
* be in sync. */
string_copy(VIEW(REQ_VIEW_BLOB)->ref, ref_blob);
* be in sync. */
string_copy(VIEW(REQ_VIEW_BLOB)->ref, ref_blob);
- } else if (line->type
=
= LINE_TREE_DIR) {
-
string_ncopy(view->ref, text, 40)
;
+ } else if (line->type
!
= LINE_TREE_DIR) {
+
return
;
}
}
+
+ string_ncopy(view->ref, text, 40);
}
static struct view_ops tree_ops = {
}
static struct view_ops tree_ops = {
@@
-2657,7
+2658,7
@@
static struct view_ops blob_ops = {
*/
struct commit {
*/
struct commit {
- char id[
41];
/* SHA1 ID. */
+ char id[
SIZEOF_REV];
/* SHA1 ID. */
char title[75]; /* First line of the commit message. */
char author[75]; /* Author of the commit. */
struct tm time; /* Date from the author ident. */
char title[75]; /* First line of the commit message. */
char author[75]; /* Author of the commit. */
struct tm time; /* Date from the author ident. */
@@
-3129,7
+3130,7
@@
report(const char *msg, ...)
}
update_view_title(view);
}
update_view_title(view);
- update_display_cursor();
+ update_display_cursor(
view
);
}
/* Controls when nodelay should be in effect when polling user input. */
}
/* Controls when nodelay should be in effect when polling user input. */