Skip to content

Commit

Permalink
Add context aware help for the "ADDED" section
Browse files Browse the repository at this point in the history
  • Loading branch information
kaste committed Jun 17, 2024
1 parent e62e07f commit f269625
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions core/interfaces/status.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ def on_selection_modified_async(self, view):
frozen_sel = list(view.sel())
if all(view.match_selector(s.a, "constant.other.git-savvy.sha1") for s in frozen_sel):
next_state = "on_commit"
elif all(view.match_selector(s.a, "meta.git-savvy.status.section.added") for s in frozen_sel):
next_state = "on_added"
else:
next_state = None

Expand Down Expand Up @@ -188,6 +190,11 @@ class StatusInterface(ui.ReactiveInterface, GitCommand):
[e] diff file [F] diff all cached files
""" + _template_help

template_help_on_added = template_help.replace(
"[u] unstage file ",
"[u] unadd file "
)

template_help_on_commit = """
##################### ###############
## SELECTED COMMIT ## ## ALL FILES ##
Expand Down Expand Up @@ -438,6 +445,8 @@ def render_help(self, show_help, help_context):

if help_context == "on_commit":
return self.template_help_on_commit.format(conflicts_bindings=self.render_conflicts_bindings())
if help_context == "on_added":
return self.template_help_on_added.format(conflicts_bindings=self.render_conflicts_bindings())
return self.template_help.format(conflicts_bindings=self.render_conflicts_bindings())


Expand Down

0 comments on commit f269625

Please sign in to comment.