Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log view fixes #1128

Merged
merged 3 commits into from
Oct 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions src/draw.c
Original file line number Diff line number Diff line change
Expand Up @@ -543,12 +543,13 @@ view_column_draw(struct view *view, struct line *line, unsigned int lineno)
{
enum line_type type = line->type;
const char *text = column_data.text;
size_t indent = 0;

if (line->wrapped && draw_text(view, LINE_DELIMITER, "+"))
return true;

if (line->graph_indent) {
size_t indent = get_graph_indent(text);
indent = get_graph_indent(text);

if (draw_text_expanded(view, LINE_DEFAULT, text, -1, indent, false))
return true;
Expand All @@ -567,11 +568,18 @@ view_column_draw(struct view *view, struct line *line, unsigned int lineno)

for (i = 0; i < box->cells; i++) {
const struct box_cell *cell = &box->cell[i];
int length = cell->length;

if (draw_textn(view, cell->type, text, cell->length))
if (indent) {
text += indent;
length -= indent;
indent = 0;
}

if (draw_textn(view, cell->type, text, length))
return true;

text += cell->length;
text += length;
}

} else if (draw_text(view, type, text)) {
Expand Down
18 changes: 14 additions & 4 deletions src/log.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,15 @@ log_open(struct view *view, enum open_flags flags)
"--stat", use_mailmap_arg(), "%(logargs)", "%(cmdlineargs)",
"%(revargs)", "--no-color", "--", "%(fileargs)", NULL
};
enum status_code code;

return begin_update(view, NULL, log_argv, flags);
code = begin_update(view, NULL, log_argv, flags);
if (code != SUCCESS)
return code;

watch_register(&view->watch, WATCH_HEAD | WATCH_REFS);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good, I just have a related question - I can't figure out how to make set refresh-mode = after-command work. It doesn't refresh after I run :!echo and type q.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I must say that I don't use it either. Wondering if anyone does... WATCH_EVENT_AFTER_COMMAND seems to be trigged only after opening an editor or running a command requiring confirmation.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hehm, yeah, the refresh code is really buggy unfortunately. It probably needs to be completely redesigned. Might be better to rip it out.


return SUCCESS;
}

static enum request
Expand Down Expand Up @@ -97,7 +104,7 @@ static bool
log_read(struct view *view, struct buffer *buf, bool force_stop)
{
struct line *line = NULL;
enum line_type type;
enum line_type type = LINE_DEFAULT;
struct log_state *state = view->private;
size_t len;
char *commit;
Expand All @@ -111,8 +118,11 @@ log_read(struct view *view, struct buffer *buf, bool force_stop)
if (commit && get_graph_indent(data) == commit - data)
state->graph_indent = commit - data;

type = get_line_type(data + state->graph_indent);
len = strlen(data + state->graph_indent);
len = strlen(data);
if (len >= state->graph_indent) {
type = get_line_type(data + state->graph_indent);
len -= state->graph_indent;
}

if (type == LINE_COMMIT)
state->commit_title_read = true;
Expand Down
44 changes: 44 additions & 0 deletions test/log/log-graph-test
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/sh

. libtest.sh
. libgit.sh

steps '
:save-display log-graph.screen
'

in_work_dir create_repo_from_tgz "$base_dir/files/scala-js-benchmarks.tgz"

test_tig log --graph e59a941

assert_equals 'log-graph.screen' <<EOF
* commit e59a941c4e7d51cd172ee2767a031f5f3fd25d05
|\ Merge: 110e090 940efaf
| | Author: Jonas Fonseca <[email protected]>
| | Date: Thu Jan 16 07:47:58 2014 -0800
| |
| | Merge pull request #4 from phaller/patch-1
| |
| | Fix link to Dart benchmark harness
| |
| | README.md | 2 +-
| | 1 file changed, 1 insertion(+), 1 deletion(-)
| |
| * commit 940efafc379db7c6df99449d6c4da98c6a2b3d07
|/ Author: Philipp Haller <[email protected]>
| Date: Thu Jan 16 15:32:52 2014 +0100
|
| Fix link to Dart benchmark harness
|
| README.md | 2 +-
| 1 file changed, 1 insertion(+), 1 deletion(-)
|
* commit 110e090f815f40d649f5432172584057b550a160
| Author: Jonas Fonseca <[email protected]>
| Date: Tue Dec 17 00:02:15 2013 +0100
|
| Update links to reflect project name change
|
| scalajs-benchmarks -> scala-js-benchmarks
[log] e59a941c4e7d51cd172ee2767a031f5f3fd25d05 - line 1 of 559 5%
EOF