Skip to content

Commit

Permalink
Merge ac1a55b into f4c97be
Browse files Browse the repository at this point in the history
  • Loading branch information
kaste committed Jan 10, 2019
2 parents f4c97be + ac1a55b commit 6783c50
Show file tree
Hide file tree
Showing 17 changed files with 1,011 additions and 247 deletions.
20 changes: 20 additions & 0 deletions Default (Linux).sublime-keymap
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,15 @@
{ "key": "setting.git_savvy.diff_view.disable_stage", "operator": "equal", "operand": false }
]
},
{
"keys": ["ctrl+z"],
"command": "gs_diff_undo",
"context": [
{ "key": "setting.command_mode", "operator": "equal", "operand": false },
{ "key": "setting.git_savvy.diff_view", "operator": "equal", "operand": true },
{ "key": "setting.git_savvy.diff_view.disable_stage", "operator": "equal", "operand": false }
]
},

//////////////////
// STAGE_DIFF VIEW //
Expand Down Expand Up @@ -174,6 +183,17 @@
{ "key": "selector", "operator": "equal", "operand": "git-savvy.diff" }
]
},
{
"keys": ["ctrl+,"],
"command": "edit_settings",
"args": {
"base_file": "${packages}/GitSavvy/syntax/diff_view.sublime-settings",
"default": "// Override settings for diff syntax-specific.\n{\n\t$0\n}\n"
},
"context": [
{ "key": "selector", "operator": "equal", "operand": "git-savvy.diff_view" }
]
},
{
"keys": ["ctrl+,"],
"command": "edit_settings",
Expand Down
20 changes: 20 additions & 0 deletions Default (OSX).sublime-keymap
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,15 @@
{ "key": "setting.git_savvy.diff_view.disable_stage", "operator": "equal", "operand": false }
]
},
{
"keys": ["super+z"],
"command": "gs_diff_undo",
"context": [
{ "key": "setting.command_mode", "operator": "equal", "operand": false },
{ "key": "setting.git_savvy.diff_view", "operator": "equal", "operand": true },
{ "key": "setting.git_savvy.diff_view.disable_stage", "operator": "equal", "operand": false }
]
},

//////////////////
// STAGE_DIFF VIEW //
Expand Down Expand Up @@ -174,6 +183,17 @@
{ "key": "selector", "operator": "equal", "operand": "git-savvy.diff" }
]
},
{
"keys": ["super+,"],
"command": "edit_settings",
"args": {
"base_file": "${packages}/GitSavvy/syntax/diff_view.sublime-settings",
"default": "// Override settings for diff syntax-specific.\n{\n\t$0\n}\n"
},
"context": [
{ "key": "selector", "operator": "equal", "operand": "git-savvy.diff_view" }
]
},
{
"keys": ["super+,"],
"command": "edit_settings",
Expand Down
20 changes: 20 additions & 0 deletions Default (Windows).sublime-keymap
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,15 @@
{ "key": "setting.git_savvy.diff_view.disable_stage", "operator": "equal", "operand": false }
]
},
{
"keys": ["ctrl+z"],
"command": "gs_diff_undo",
"context": [
{ "key": "setting.command_mode", "operator": "equal", "operand": false },
{ "key": "setting.git_savvy.diff_view", "operator": "equal", "operand": true },
{ "key": "setting.git_savvy.diff_view.disable_stage", "operator": "equal", "operand": false }
]
},

//////////////////
// STAGE_DIFF VIEW //
Expand Down Expand Up @@ -174,6 +183,17 @@
{ "key": "selector", "operator": "equal", "operand": "git-savvy.diff" }
]
},
{
"keys": ["ctrl+,"],
"command": "edit_settings",
"args": {
"base_file": "${packages}/GitSavvy/syntax/diff_view.sublime-settings",
"default": "// Override settings for diff syntax-specific.\n{\n\t$0\n}\n"
},
"context": [
{ "key": "selector", "operator": "equal", "operand": "git-savvy.diff_view" }
]
},
{
"keys": ["ctrl+,"],
"command": "edit_settings",
Expand Down
3 changes: 1 addition & 2 deletions Default.sublime-keymap
Original file line number Diff line number Diff line change
Expand Up @@ -607,8 +607,7 @@
},
{
"keys": ["tab"],
"command": "gs_diff_toggle_setting",
"args": { "setting": "in_cached_mode" },
"command": "gs_diff_toggle_cached_mode",
"context": [
{ "key": "setting.command_mode", "operator": "equal", "operand": false },
{ "key": "setting.git_savvy.diff_view", "operator": "equal", "operand": true }
Expand Down
16 changes: 12 additions & 4 deletions common/util/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,26 @@ def decorated_run(self, *args, **kwargs):
# NEW-VIEW HELPER FUNCTIONS #
#############################

def get_scratch_view(context, name, read_only=True):
def create_scratch_view(window, name, read_only=True):
"""
Create and return a read-only view.
Create and return a scratch view.
"""
window = context.window if hasattr(context, "window") else context.view.window()
view = window.new_file()
view.settings().set("git_savvy.{}_view".format(name), True)
view.settings().set("git_savvy.{}".format(name), True)
view.set_scratch(True)
view.set_read_only(read_only)
return view


def get_scratch_view(context, name, read_only=True):
"""
Create and return a scratch view.
Given `name` gets expanded to `{name}_view`.
"""
window = context.window if hasattr(context, "window") else context.view.window()
return create_scratch_view(window, "{}_view".format(name), read_only=read_only)


def get_is_view_of_type(view, typ):
"""
Determine if view is of specified type.
Expand Down
2 changes: 0 additions & 2 deletions core/commands/commit_compare.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,13 @@ def run_async(self):
"base_commit": target_commit,
"target_commit": base_commit,
"file_path": file_path,
"disable_stage": True,
"title": "DIFF: {}..{}".format(target_commit, base_commit)
})
else:
self.view.window().run_command("gs_diff", {
"base_commit": base_commit,
"target_commit": target_commit,
"file_path": file_path,
"disable_stage": True,
"title": "DIFF: {}..{}".format(base_commit, target_commit)
})

Expand Down
Loading

0 comments on commit 6783c50

Please sign in to comment.