PreviousNextTracker indexSee it online !

(23/212) 71 - Undo tracks caret movement

(based on experiences w/ v4.3pre6)
The undo system should (optionally?) track all caret
movement in conjunction with edits. When undo is
called, caret movement is also undone, in order, with
edits. Caret should be positioned so that, after an
edit-undo, the user can immediately start typing again,
without repositioning the caret. For caret movement,
each undo call undoes one caret movement, i.e.
equivalent to the caret movement keystrokes, left,
right, up, down, pgup, pgdn, etc. An(other) option for
the undo system to compress consecutive caret movements
(e.g. 50 consecutive "right"s undone in one UNDO).

Thanks\!

Submitted jpotelle - 2006-10-10 15:24:44 Assigned
Priority 5 Labels core
Status open Group None
Resolution None

Comments

2006-10-10 15:27:34
jpotelle

Logged In: YES
user_id=1124785

Caret movement generated by "search" and "search/replace"
should also be undoable. One UNDO call undoes one "search"
call or "search/replace" call.

2006-10-10 15:42:45
hunteke

Logged In: YES
user_id=1271235

I second the idea, but I would emphasize the optional part.
As I write, I do occasionally use the undo buffer to
compare what I had and what I've got, sometimes beyond the
save point.

2006-10-11 13:02:36
hertzhaft

Logged In: YES
user_id=1037294

As far as I see, jEdit \*does\* set the caret to where the
undone editing happened. If you want to "undo" recent caret
movements, try the "Navigator" plugin.

2006-10-12 14:38:13
jpotelle

Logged In: YES
user_id=1124785

The caret position is not always restored correctly. Try
this simple test. Open a new buffer, on line 1 type without
mistakes or corrections:
one two three four
Then move the caret to column 1 (home). Then delete the
first word with one keystroke. Now hit UNDO only once.
Where is your caret? It's not in column 1 and it's not at
the EOL. It's at the 2nd word; a position totally unrelated
to actual caret movement you performed when typing line 1.

2006-10-12 14:44:47
jpotelle

Logged In: YES
user_id=1124785

Generally, jEdit is too greedy when undoing typing. Rather
than tracking "commands" for undoing, individual keystrokes
along with commands should be tracked. If I type "one two
three four", I want UNDO to un-type one character at a time
for non-white space chars. This, along with my original
feature request above, is how I would like jEdit to behave.
It's fine with me if the default behavior is unchanged (and
I believe it should be unchanged for existing jEdit users);
a user option allowing this alternate behavior would be great\!

2006-10-12 19:00:56
jpotelle

Logged In: YES
user_id=1124785

Generally, jEdit is too greedy when undoing typing. Rather
than tracking "commands" for undoing, individual keystrokes
along with commands should be tracked. If I type "one two
three four", I want UNDO to un-type one character at a time
for non-white space chars. This, along with my original
feature request above, is how I would like jEdit to behave.
It's fine with me if the default behavior is unchanged (and
I believe it should be unchanged for existing jEdit users);
a user option allowing this alternate behavior would be great\!

2006-10-12 20:01:36
hunteke

Logged In: YES
user_id=1271235

While we're on the subject of /optional/ undo movement, I
got used to the Borland C++ IDE's (2.0? 3.0? I can't
remember) version of undo a long time ago. As opposed to
compressing undo actions, it undid everything that the
cursor did. So if I typed space space space 1 2 3, and then
typed some other characters, then waited, then highlighted
and deleted a paragraph, then decided I wanted to go back,
it behaved exactly as if I was going back in time. Hitting
C+z undid the delete paragraph option, complete with
positioning the cursor exactly where it was when I hit the
delete key, as well as rehighlighting the now restored text.
If I continued to hit C+z, it would unhighlight each line,
in the exact order I'd highlighted. It also undid each
character and viewing window movement, so if I hit left
right, and then hit undo, it would move right, then left.
Or if I hit down enough times to move the viewing window
down, hitting C+z would move the cursor back up each line,
as well as scroll the window up each line.

I imagine that I'd be only one who'd use it in this (inane)
way, but I remember recapping my thought process through the
use of undo and redo on that system. It was great for
leaving for 10-15 minutes and coming back and being able to
quickly see what my thought-process had been. (From time
I'd hit C+z and realize that I had contually hit up and down
comparing two bits of code here and there. :) )

Along those lines, it might be cool to have a perpetual undo
buffer for files. Kind of like a bash_history or something.
Certainly for space restrictions, there would need to be a
limit on how far back the undo went and on how many recent
files for which undo logs were kept, but I think it could be
useful.

Would/do these ideas interest anyone else?

2006-10-15 13:29:45
jpotelle

Logged In: YES
user_id=1124785

Borland IDE's: yes, and exactly the same undo functionality
with BREIF (Professional Programers Editor - MS-DOS) and
CodeWright (ditto - Windows) both of which Borland owns and
have now discontinued. jEdit would attract many additional
programmers if it had an emulation for BREIF and/or CodeWright.

2009-12-30 09:50:42
ezust

I recommend using the Navigator plugin to go back to previous caret positions, rather than Undo.
Since 4.3pre5, it's been reworked significantly and is very eclipse-like.