Skip to content

Commit

Permalink
Updating select duplicate command to enable "soft undo/redo"
Browse files Browse the repository at this point in the history
  • Loading branch information
LordBrom committed Oct 7, 2020
1 parent b9bcce7 commit 51a5c6a
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions hightlight_duplicates.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,12 @@ def show_lines(regions, view):
def add_lines(regions, view):
'''Merges all duplicated regions in one set and highlights them.'''
view.sel().clear()
all_regions = []
for r in regions:
for i in r:
view.sel().add(i)


def remove_lines(regions, view, edit):
all_regions = []
for r in reversed(regions):
view.erase(edit, sublime.Region(r.begin()-1, r.end()))

Expand Down Expand Up @@ -223,9 +221,10 @@ def run(self):
highlight_duplicates(self.window.active_view())


class ToggleSelectDuplicatesCommand(sublime_plugin.WindowCommand):
def run(self):
select_duplicates(self.window.active_view())
class ToggleSelectDuplicatesCommand(sublime_plugin.TextCommand):
def run(self, edit):
select_duplicates(self.view)
self.view.end_edit(edit)


class RemoveDuplicatesCommand(sublime_plugin.TextCommand):
Expand Down

0 comments on commit 51a5c6a

Please sign in to comment.