Sublime Forum

Undo and redo

#1

Sublime text is great except for undo and redo. I will often find my self in a situation where flipping between undo and redo does something that I cannot see as my view is elsewhere. Sometimes I can see it on the minimap but what good does that do. Yes, undo-redo happening at a totally different location than my view!

I also sometimes find that undoing something moves me to another view of the file after the change. Why would I want this? I am interested in the undo not my cursor position before that! A redo will move the view back but then also do the redo so effectively I have no idea what the undo was, again.

I think maybe something is wrong. Can anyone explain to me what is going on. Am I crazy?

0 Likes

#2

I am wondering why I have not gotten any responses. I just got into a situation where undo/redo was changing something but my view was not changing so I could see nothing happening. I can sometimes see stuff changing in the minimap so I know I am not crazy. My work-around: save the undo state then save the redo state then do a diff on the files. This is very significant bug as far as I am concerned. Am I missing something? I really like sublime text but this is an issue to me. I wish it was for others to.

0 Likes

#3

This has something to do with having multiple views of the file open at once, and then making changes in one of the views and performing the undo in another one.

For example, here’s me making random changes to some sample text (some Sublimerge update text that PackageControl just spat out). I can make changes and when I undo, the view jumps there to show me what it’s doing.

Now here’s a similar thing, only here I open a cloned view to the file, make the changes in the first file, then switch to the other file and perform the undo operation there.

The first undo undoes the change made in the first view, but it also undoes the cursor position change made in this view. After that the buffer changes but the cursor position does not.

Maybe a bug, maybe by design? On the face of it you might think that it’s a bug because it doesn’t always jump you to the location the changes are happening in. On the other hand you might think that it was a feature because each view supports its own edit position.

Either way it seems a little wonky that the undo seems to undo the cursor change in this view while also undoing the change from the second view. It seems like it should either undo both or neither from the same view.

I’m not sure what a satisfactory resolution for this would be; always undo as if you made changes here, even if that shifts where you had the view positioned? Only undo changes made to the buffer in this view?

May be worth logging an issue. I did a little (non-exhaustive) search and found no setting that might tweak this behaviour.

1 Like

#4

No. This has nothing to do with multiple views. Google “sublime text undo redo” or in this forum:


Other people have indeed had this problem. Note the second post does not actually have a solution.

This one issue has made me look at other editors like atom which unfortunately is unusably slow and clunky.

0 Likes

#5

Well I guess we solved the mystery regarding why you didn’t get any responses.

1 Like

#6

@greguvw It would be helpful if you could identify the specific situation(s) that cause the behaviour you describe, as the typical behaviour is to scroll into view the location of the undo. It seems that something is not right on your system. Can you try a portable build and see if the behaviour is the same? If not, perhaps one of your installed extensions is interfering.

As an aside, the normal/typical behaviour could be better too. I often find myself doing undo-redo-undo, where the first undoes and brings into view, the second redoes while in view, and the third undoes again. This sequence allows one to clearly see ‘what’ has been undone, which is not always clear when the undo happens concurrently with the scroll to view.

0 Likes

#7

I guess I don’t know what you mean. I provided references to old posts with the same problem. People who are trying to deal with it through the API? Is it because I disagreed with you. Sorry, but please provide a response with some information content or not at all. At least tell me why I am wrong. Your sarcasm is not appreciated.

0 Likes

#8

I am glad that someone else is seeing this behaviour. But, I disagree with the response a bit because the sequence does not allow one to see what is changing. Sometimes, undo brings one back to the positions with stuff undone then redo puts you back to the new position with stuff done again. So, you cannot see the changes happening.

“It seems that something is not right on your system.” is probably not the most thought through statement. If this issue was system related then there would be some serious problems overall as undo/redo behaviour in sublime text should not be system related.

It is hard to reproduce but when it happens again I will try to see exactly how it happened and to provide a reproducible example. I thought the posts that I referenced were clear about this but evidently not.

I would appreciate if responses were a little less noise that OdatNurd’s last response. We are all trying to be productive here. Aren’t we?

0 Likes

#9

What I meant was that before I started to look into the problem I did the same google search you did and found the same post, which ends with JPS (the developer of the software) saying that the problem would be fixed “in tomorrows dev build”, which was circa February 2015.

Given that it was something that was previously reported and (supposedly) fixed, there is probably not a lot more to say about it, particularly by people that aren’t experiencing the problem. The insinuation is that probably nobody bothered to pop into the thread to post anything because there’s nothing more to say about it than what has already been said, not the sarcasm you seem to think was expressed.

I did (provide a response with some information content), you just summarily dismissed it, that’s all. I’ve only been using Sublime for a couple of months, but I’m using it for 100% of my daily development work, and this is not a problem I’ve ever seen. However, since in your original post, you said:

I also sometimes find that undoing something moves me to another view of the file after the change

This lead me to believe that (unlike me) you tend to have duplicate views of the same file open. As such, I checked to see if having a second view of the file open might cause the issue you described to happen.

Nor is this accusation, if we’re going to spend time sharing things we don’t appreciate instead of just getting to the bottom of the issue you’re having.

0 Likes

#10

Well as far as info content I was referring to your second response.

Your first post was informative but it wasn’t what I was talking about. I can be sure of this as I hardly ever use multiple views but run into the problem I am talking about about 1-5 times a day.

Anyway, I’ve seen the post by JPS but in fact it was never addressed. It seems to be related to saving cursor position in history but I can’t reproduce it on this alone. I will keep working and when it happens again will try to back track to get a reproducible case.

0 Likes

#11

If you get into a position where it happens, even if you can’t reproduce it you might try using soft undo and soft redo and see if they exhibit the same problem in that situation. The default key bindings are Ctrl+U for soft undo and Ctrl+Shift+U for soft redo (for windows, anyway).

They’re supposed to work like the standard functions but (IIRC) they also track and undo/redo the selection state. Possibly whatever underlying issue is causing the problem might not be tweaked by those versions, which might help in narrowing down what exactly is going wrong.

The only other thing that comes to mind is one of your installed packages doing you favours as @qgates mentioned above. However without a reproducible test case that would require you to work without the tools you’re used to having at your disposal, which is less than ideal.

1 Like

#12

This is still a problem - I was editing a python script and undid a lot of changes to find where the issue happened with the intention of REDOING - but after I removed all of it, then saved - all of my redos were GONE!!

This is a critical bug.

0 Likes