Skip to content

Commit caf8eb1

Browse files
authored
Merge pull request #22 from GlaceCoding/feature-soft-update
Add a SOFT setting to prevent to overwrite redo stack of command_history
2 parents f91c9f6 + 0932f80 commit caf8eb1

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

main.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,4 +85,6 @@ def run(self, edit):
8585
class eventListener(EventListener):
8686

8787
def on_pre_save(self, view):
88-
view.window().run_command('update_header')
88+
str, dict, index = view.command_history(1, True)
89+
if index == 0 or not settings.SOFT:
90+
view.window().run_command('update_header')

settings.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ class Settings:
1010

1111
DATE_TIME_FORMAT = '%Y/%m/%d %H:%M:%S'
1212

13+
# If SOFT is True, the update is only done if the redo stack is empty
14+
SOFT = False
15+
1316
def __init__(self):
1417
self.all = load_settings(Settings.SETTINGS_FILE)
1518

0 commit comments

Comments
 (0)