Skip to content

Commit 3b7a071

Browse files
authored
Merge pull request #1999 from timbrel/wide-jump-fixups
2 parents f841b1f + abe2673 commit 3b7a071

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

core/commands/help_panel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ class gs_log_graph_help_panel(GsAbstractOpenHelpPanel):
259259
[{cr}-r] Goto tags, branches...
260260
[h] Goto HEAD commit
261261
[up]/[down] go to previous/next commit (also: [,]/[.] or [j]/[k] in vintageous mode)
262-
Use [alt+up]/[alt+down] for wider jumps
262+
Use [alt+up]/[alt+down] for wider jumps, e.g. to jump between fixup commits
263263
264264
### Other ###
265265
[?] show this help popup

core/commands/log_graph.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1616,11 +1616,25 @@ def run(self, edit, forward=True):
16161616
view.run_command("gs_log_graph_navigate", {"forward": forward})
16171617
return
16181618

1619+
# We actually want to intertwine edge commits and marked fixup commits
1620+
# but I think that is difficult to do elegantly. So I do it manually.
1621+
marked_fixup_dots = [
1622+
colorizer.Char(view, r.a) for r in view.get_regions('gs_log_graph_follow_fixups')
1623+
if (r.a > cur_dot.pt if forward else r.a < cur_dot.pt)
1624+
]
1625+
if marked_fixup_dots:
1626+
next_fixup = marked_fixup_dots[0] if forward else marked_fixup_dots[-1]
1627+
else:
1628+
next_fixup = None
1629+
16191630
next_dots = follow_first_parent(cur_dot, forward)
16201631
try:
16211632
next_dot = next(next_dots)
16221633
except StopIteration:
1623-
return
1634+
if next_fixup:
1635+
next_dot = next_fixup
1636+
else:
1637+
return
16241638

16251639
if line_distance(view, cur_dot.region(), next_dot.region()) < 2:
16261640
# If the first next dot is not already a wide jump, t.i. the
@@ -1641,6 +1655,9 @@ def run(self, edit, forward=True):
16411655
except UnboundLocalError:
16421656
pass
16431657

1658+
if next_fixup:
1659+
next_dot = (min if forward else max)(next_dot, next_fixup, key=lambda dot: dot.pt)
1660+
16441661
line = line_from_pt(view, next_dot.region())
16451662
r = extract_comit_hash_span(view, line)
16461663
if r:

0 commit comments

Comments
 (0)