On 03/17/2015 10:54 AM, Jean-Marc Lasgouttes wrote:
Le 17/03/2015 14:07, Richard Heck a écrit :
On 03/17/2015 05:08 AM, Jean-Marc Lasgouttes wrote:
Le 16/03/2015 18:43, Jean-Marc Lasgouttes a écrit :
commit ed3d9544a331a7c28730089e7b059eea592584c4
Author: Jean-Marc Lasgouttes <lasgout...@lyx.org>
Date: Thu Mar 12 14:47:39 2015 +0100
Improve undo of consecutive insertions/deletions
This commit implements an idea of Scott about making undo of typed
text more useful. I'd like everybody to try it out and tell me whether
the behavior is useful. There are other alternatives, like saving at
word level. I am not sure whether there are better ideas implemented
in other programs/platforms.
I see the description below, but can you say what the practical effect
of the change is supposed to be? I.e., what will we as users see?
In branch, type a very very long sentence and then use undo
repetitively. See how undo works by blovks of 20 characters.
Now do the same by deleting a long sentence (the same?) by keeping you
finder on the backspace key. Press undo and see how the sentence comes
back to life in one time.
What we experiment here is the break the undo chunks by looking if you
stopped typing during something like 1 and 2 seconds (I use time(), so
that the granularity is 1 second). This could suupposedly "feel right".
There could be other solutions:
* break at each space (word by word)
* break at each dot+space (sentence); this would be unreliable
* you other ideas???
This is a minor thing, actually. What I do not know is what is done on
other major platforms.
LibreOffice Writer restores each "word" one at a time, with a sequence
of spaces counting as a word. So if you have:
this is some stuff that I can test. this is some stuff that I can
test.
and delete the first sentence backwards a character at a time, it restores:
this
[space]
is
[space]
some
etc, etc.
I don't have access to any other word processors. But Kile (and so
presumably the KDE embedded editor) seems to group all typing as one
undo until you do something else: Hit return, backspace, delete, etc.
Thunderbird acts the same way, but it includes returns in the group.
I guess I marginally prefer the Libre Office behavior. Suppose, for
example, with the new LyX behavior, that I'm typing out some notes, and
I'm just typing and typing and typing. Then I stop and hit Undo, and it
undoes the whole paragraph I've just typed. That's not necessarily
wrong. As I said, Kile will do that, too. And in practice, it probably
isn't so bad, since if I backspace to fix something, that creates a new
Undo group. So, in practice, what you get are "chunks" of text and
deletions, where (in our case) those may be broken by pauses.
If you want to keep something like the current behavior, then maybe it'd
be worth just getting rid of the time() check. Then the behavior would
be similar to Kile and Thunderbird.
Richard