summaryrefslogtreecommitdiff
path: root/lib/syntax_suggest/scan_history.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/syntax_suggest/scan_history.rb')
-rw-r--r--lib/syntax_suggest/scan_history.rb11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/syntax_suggest/scan_history.rb b/lib/syntax_suggest/scan_history.rb
index c5664d0f65..2be4aaf3c0 100644
--- a/lib/syntax_suggest/scan_history.rb
+++ b/lib/syntax_suggest/scan_history.rb
@@ -17,13 +17,20 @@ module SyntaxSuggest
def commit_if_changed
if changed?
@history << CodeBlock.new(lines: @code_lines[before_index..after_index])
- refresh_index
end
self
end
- def try_rollback
+ # Discards any changes that have not been committed
+ def stash_changes
+ refresh_index
+ end
+
+ # Discard changes that have not been committed and revert the last commit
+ #
+ # Cannot revert the first commit
+ def revert_last_commit
if @history.length > 1
@history.pop
refresh_index