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
Right now the selection restoring algorithm is pretty naive. Selection just before the first operation from a batch is remembered. Then, when that batch is undone, the remembered ranges are retrieved and they are transformed by all the operations from the history that happened after that ranges got remembered.
Consider this deltas history stack, done by two batches (ABC and 123 batches):
<selection state 1 saved>
1
2
<selection state A saved>
A
B
3
C
After ABC batch is reversed, the history is as follows:
<selection state 1 saved>
1
2
<selection state A saved>
A
B
3
C
C'
B'
A'
and <selection state A> is transformed by A, B, 3, C, C', B', A' to get to proper state.
It feels redundant that we have to transform selection by deltas from batch ABC and then by it reversed+transformed counterparts if changes done by batch ABC are removed. On the other hand we cannot simply transform selection just by delta 3 because delta 3 "remembers" the A and B deltas.
We can, however, get a version of 3 that is trasformed by reversed A and B. Let's call it 3'. That would be a version of 3 that does not "remember" A and B. Then - we could transform the selection only by 3'.
It's true that transforming 3 to 3' would take some time, but I think that in some cases this might result in much less steps for selection transforming which means it would be faster and easier to debug.
Also, right now, this case needs 6 range transformation steps:
<selection state A saved>
A
B
C
C'
B'
A'
Where it's clear that it requires none.
The text was updated successfully, but these errors were encountered:
Right now the selection restoring algorithm is pretty naive. Selection just before the first operation from a batch is remembered. Then, when that batch is undone, the remembered ranges are retrieved and they are transformed by all the operations from the history that happened after that ranges got remembered.
Consider this deltas history stack, done by two batches (
ABC
and123
batches):After
ABC
batch is reversed, the history is as follows:and
<selection state A>
is transformed byA
,B
,3
,C
,C'
,B'
,A'
to get to proper state.It feels redundant that we have to transform selection by deltas from batch
ABC
and then by it reversed+transformed counterparts if changes done by batchABC
are removed. On the other hand we cannot simply transform selection just by delta3
because delta3
"remembers" theA
andB
deltas.We can, however, get a version of
3
that is trasformed by reversedA
andB
. Let's call it3'
. That would be a version of3
that does not "remember"A
andB
. Then - we could transform the selection only by3'
.It's true that transforming
3
to3'
would take some time, but I think that in some cases this might result in much less steps for selection transforming which means it would be faster and easier to debug.Also, right now, this case needs 6 range transformation steps:
Where it's clear that it requires none.
The text was updated successfully, but these errors were encountered: