Cudatext: Undo/redo jumps to search position

Created on 23 Mar 2021  路  28Comments  路  Source: Alexey-T/CudaText

From #3248:

Another unexpected behaviour:

  1. Type something on line, for example, 100
  2. Press Ctrl+F and find any text on line 25, for example
  3. Go to main window and try Ctrl+Z/Ctrl+Y

You can see it undoes/redoes editing on the line 100, but moves the caret to line 25 every time. So, all the changes it does are completely unclear because they're out of the screen.

Demo
Watch the minimap. There you can see another line but in the main window it isn't obvious what's going on.

  • First jump is related to search. I pressed Alt+N and then Enter in the search dialog, so it jumped to the first match.
  • Then I pressed Ctrl+F to leave search dialog.
  • Then I pressed Ctrl+Z. It deletes another line as the last change.
  • Then Ctrl+Y (I use Ctrl+Y for redo) returns the last change but moves caret to fff

    The cares should jump to undo/redo position but it jumps on the search position instead.

bug

All 28 comments

You can see it undoes/redoes editing on the line 100, but moves the caret to line 25 every time. So, all the changes it does are completely unclear because they're out of the screen.

seems #3248 , its fix, makes it better. beta is public in /c/ folder.
in common, such caret jumps are ok, as designed a ~year ago. for user req.
it is also like in ST3 or VScode, no?
VScode makes it better?

Had no chance to test, will check it today.

in common, such caret jumps are ok, as designed a ~year ago. for user req.

Do you mean an user requested to move caret on search position while performing undo/redo instead of jumping to undo/redo position? But why?

because Undo is grouped (by option), so each action takes several simple actions.

Oh, I see. It considers caret movements as undo actions. But not in all cases.

  1. If I made a change and then made left-click in any place and then Ctrl+Z, it undoes the change.
  2. If I do the same, but move caret with keyboard and then Ctrl+Z it undoes the change.
  3. If I made the same as in first case, but then add redo and then undo again, it undoes caret movement! And it also doesn't with keyboard movements!

Not obvious logic. And it conflicts with #3248. I mean in general in works, but sometimes in undoes caret movement, sometimes the change itself. Is there an option to disable considering caret movements as undo action? I checked ST3 and there is no such behaviour. Yes, it might be useful for someone, but I prefer obvious logic.

I made changes in undo logic (small), I 've put the new beta. regarding clicks it works the same though: mouse click is the undo action, and keyboard caret moving is not. so your 3 cases work almost the same...
it's simple logic-- mouse click makes new undo action.

(pls test new beta)

I'm sorry, hard to say it but now it's even worse. This issue still present and issue from #3248 still present. Just perform test from the first post of this issue and let me prepare video demo to show the problem.

now it's even worse

Sorry, I may have rushed. Perhaps I did something wrong. Cannot reproduce. Let me just show you how it looks in CT vs ST3.

please do it.

undo_redo_CT_ST3.zip
Please, take a look. Almost the same combination, but in ST3 I can see what's going on. From my point caret movement shouldn't be a part of undo history. But if someone once requested it then there should be the option to enable/disable such behavior.

And the second point. After undo we can see disappearing "b" but it should be "bbb". It's related #3248. Now it seems the delay is placed somewhere in the middle, not directly after jump.

I'm pretty sure all these issues could be fixed but here, as I said before, we have some mutual exclusive approaches. It could jump, it also could consider clicking as undo action, it could use delay or not but it won't work all together. But if there would be options to enable/disable each behaviour then one could tune CT as he wants. So, I'm propose not to cancel someone's request you did year ago, but just add options to allow me disable what I don't like and enable what I like :)

I am workin of this... found one issue in making redo-data...

made some fixes, now report from post1 is fixed, seems.
beta updated.

@xcme Pls test again, new beta was made now.

@Alexey-T, unfortunately, a lot of new issues here but I don't see logic yet:

  • Now it jumps to upper line (25 as in the first post) after redo
  • Now the issue with delay you fixed here has returned back
  • Once I got delay between each action line on undo, so it took about 10 second to redraw 50 lines

And let me rephrase one of my previous statement from here:
"While caret movement is considered as an undo action is completely meaningless to perform any tests because we have one non-obvious logic overlapped by another non-obvious logic"

I'm doing the same tests but get different results every time. Let me know how to completely disable considering caret movement as an undo action.

made new beta. in it--

  • new option "undo_for_caret_jump":true. seems you need it as Off?
  • changed default pause "undo_pause":300. seems you need it small?

no logic change. now I already has 1st post solved.
I mean logic changed today. when I do Undo/Redo for caret-jumps. it is ok for me.
1st post solved now?
let's post OTHER issues to new posts

I mean

Once I got delay between each action line on undo, so it took about 10 second to redraw 50 lines

pls, report to new issue to not forget.

* new option "undo_for_caret_jump":true. seems you need it as Off?

Doesn't work. When I press mouse click somewhere and then undo it just jumps back.

1st post solved now?

Seems yes, but let it open for a while. Let's close all issues together. Just in case if some issue will raise once again.

I will open a new issue for undo_for_caret_jump now.

yes, new issue please.

Once I got delay between each action line on undo, so it took about 10 second to redraw 50 lines

Seems fixed, At least I don't see it now. (But I also don't know the way to reproduce).

But it seems that

Undo/redo jumps to search position

is sill an issue even with 'undo_for_caret_jump' = False

I'm trying to find the way to reproduce. At the moment I'd say that most of issue were fixed, but it isn't finished yet.

@Alexey-T try to reproduce steps from the first post twice in a row. Usually first time it doesn't jump (as expected) but after repeating steps 2 and 3 it's starting to jump again.

seems fixed this. new beta will be in 30minites. with one moment: with 'undo_for_caret_jump':false I see not OK caret position after Redo (shift 1 char left)

beta is posted just now. pls test in this beta.

Yes, seems fixed.
The last issue I can see for that here I also see in that case.

Seems fixed in the last beta

@xcme let's close?

Was this page helpful?
0 / 5 - 0 ratings