You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This happens because when you go back on the history, the self.current_item is decremented twice as showed next:
defjump_back(self, active_view):
""" Return the view and selection list to jump back to Jump back in history. If the current_item is -1, it also pushes the active view sel() into the history. """ifself.current_item==0:
...
self.current_item=-1
...
self.current_item-=1
Then, once we go back on history and jump forth with jump_forward command, the self.current_item will be -1, instead of 0.
This will cause the line del self.history_list[self.current_item + 1:] to become
delself.history_list[-1+1:]
# which is equivalent to the following, and deletes the whole listdelself.history_list[:]
This simple patch can fix this whole history deletion bug while keeping the plugin correctly trimming old branches of history:
history_list.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/history_list.py b/history_list.py
index 0dc2318..188c4a8 100644
--- a/history_list.py+++ b/history_list.py@@ -120,7 +120,8 @@ class JumpHistory():
for i in range(-1, self.current_item):
view, key = self.history_list[i]
view.erase_regions(key)
- del self.history_list[self.current_item + 1:]+ if self.current_item < -1:+ del self.history_list[self.current_item + 1:]
# set current_item to the imaginary back (current caret position not yet pushed)
self.current_item = 0
Note: self.current_item is either 0 or negative, but never positive because the history list is built backwards, i.e., from the front its to back.
As the note I added at the bottom, the possible values of self.current_item are from 0 up to -sys.maxsize, not +sys.maxsize:
Note: self.current_item is either 0 or negative, but never positive because the history list is built backwards, i.e., from the front its to back.
Also there is this note on the history_list.py explaining this:
# current_item point to newest item of the queue, which is at the back of the# list. To make appending easier current_item is a negative index# current_item would be -1 to point to the newest item and -len to point to oldestself.current_item=0self.key_counter=0
Description
This happens because when you go back on the history, the
self.current_item
is decremented twice as showed next:Then, once we go back on history and jump forth with
jump_forward
command, theself.current_item
will be-1
, instead of 0.This will cause the line
del self.history_list[self.current_item + 1:]
to becomeThis simple patch can fix this whole history deletion bug while keeping the plugin correctly trimming old branches of history:
Note:
self.current_item
is either 0 or negative, but never positive because the history list is built backwards, i.e., from the front its to back.Environment
10 build 15063 x64
1920x1080
1.0
3207
Related threads
and
jump_forward` does not record most actionsjump_back
andjump_forward
does not record most actions #2959The text was updated successfully, but these errors were encountered: