Skip to content

Commit

Permalink
Merge pull request #724 from divmain/randy3k/in_diff_view
Browse files Browse the repository at this point in the history
Enhancement: disable "reset line" and "reset hunk" in inline diff cached mode
  • Loading branch information
asfaltboy committed Jul 27, 2017
2 parents 5a90caf + 9bf1f0f commit b4ed30c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
6 changes: 4 additions & 2 deletions Default.sublime-keymap
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
"args": { "reset": true },
"context": [
{ "key": "setting.command_mode", "operator": "equal", "operand": false },
{ "key": "setting.git_savvy.inline_diff_view", "operator": "equal", "operand": true }
{ "key": "setting.git_savvy.inline_diff_view", "operator": "equal", "operand": true },
{ "key": "setting.git_savvy.inline_diff_view.in_cached_mode", "operator": "equal", "operand": false },
]
},
{
Expand All @@ -35,7 +36,8 @@
"args": { "reset": true },
"context": [
{ "key": "setting.command_mode", "operator": "equal", "operand": false },
{ "key": "setting.git_savvy.inline_diff_view", "operator": "equal", "operand": true }
{ "key": "setting.git_savvy.inline_diff_view", "operator": "equal", "operand": true },
{ "key": "setting.git_savvy.inline_diff_view.in_cached_mode", "operator": "equal", "operand": false },
]
},
{
Expand Down
6 changes: 3 additions & 3 deletions core/commands/inline_diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def run_async(self, settings=None, cached=False):
file_ext = util.file.get_file_extension(os.path.basename(settings["git_savvy.file_path"]))
self.augment_color_scheme(diff_view, file_ext)

diff_view.settings().set("git_savvy.inline_diff.cached", cached)
diff_view.settings().set("git_savvy.inline_diff_view.in_cached_mode", cached)
for k, v in settings.items():
diff_view.settings().set(k, v)

Expand Down Expand Up @@ -142,7 +142,7 @@ class GsInlineDiffRefreshCommand(TextCommand, GitCommand):

def run(self, edit):
file_path = self.file_path
in_cached_mode = self.view.settings().get("git_savvy.inline_diff.cached")
in_cached_mode = self.view.settings().get("git_savvy.inline_diff_view.in_cached_mode")
savvy_settings = sublime.load_settings("GitSavvy.sublime-settings")
ignore_eol_arg = (
"--ignore-space-at-eol"
Expand Down Expand Up @@ -397,7 +397,7 @@ def run(self, edit, **kwargs):
sublime.set_timeout_async(lambda: self.run_async(**kwargs), 0)

def run_async(self, reset=False):
in_cached_mode = self.view.settings().get("git_savvy.inline_diff.cached")
in_cached_mode = self.view.settings().get("git_savvy.inline_diff_view.in_cached_mode")
savvy_settings = sublime.load_settings("GitSavvy.sublime-settings")
ignore_ws = (
"--ignore-whitespace"
Expand Down
8 changes: 4 additions & 4 deletions popups/inline_diff_view.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ <h3>Actions</h3>
<ul>
<li><code><span class="shortcut-key">o&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>open file at hunk</code></li>

<li><code><span class="shortcut-key">l&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>stage line</code></li>
<li><code><span class="shortcut-key">h&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>stage hunk</code></li>
<li><code><span class="shortcut-key">L&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>reset (unstage) line</code></li>
<li><code><span class="shortcut-key">H&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>reset (unstage) hunk</code></li>
<li><code><span class="shortcut-key">l&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>stage line / unstage line (in cached mode)</code></li>
<li><code><span class="shortcut-key">h&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>stage hunk / unstage line (in cached mode)</code></li>
<li><code><span class="shortcut-key">L&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>reset line</code></li>
<li><code><span class="shortcut-key">H&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>reset hunk</code></li>
<li><code><span class="shortcut-key">.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>go to next hunk</code></li>
<li><code><span class="shortcut-key">,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>go to previous hunk</code></li>
</ul>
Expand Down

0 comments on commit b4ed30c

Please sign in to comment.