Date: prev next · Thread: first prev next last
2016 Archives by date, by thread · List index


Philip Jackson schreef op 04-09-2016 15:58:
On 03/09/16 21:39, Gabriele Ponzo wrote:
2016-09-03 20:02 GMT+02:00 Xen <list@xenhideout.nl>:

[…]
They are not grouped together like in other applications.

Ok, I got it now.

Sorry for my misunderstanding :)
---
Gabriele Ponzo


Hi - wait a minute. I think Gabriele has it right according to the way I
understand the OP's problem.

No my friend, it is as I said.

I am not deleting text.

I am undoing writes.

Work flow:

type text
delete block of text
rewrite block of text
figure I was wrong in deleting it
undo the writing
undelete the block I just deleted

The deletion happend in one block.

However the writing happens by character and it doesn't coalesce or merge them into words in the undo buffer.

Since, in order to get back to my previous text, that I deleted in one operation, I have to go through the undo buffer (since it is sequential in history) I first have to undo the writing I just did.

But the writing took up one undelete step per character and quickly expunged or evacuated the delete buffer from the history.

At one point that delete buffer was there. But writing individual characters takes up so much undelete steps and they are not merged together in memory (so as to form, for example, words) even a modest amount of typing will quickly fill the undo buffer completely and thereby delete the delete buffer that existed prior.

It is thrown out of memory because those 100 characters quickly fill up the "chain".

So, you can't get your text back because LO threw it away.

And really.... for no other reason than that it treats single characters the same as huge blocks of text. It will happily remember a block of 5k. That you just deleted, for instance. But it also happily remembers blocks of 1 character, and it treats all of those blocks the same.

It has no qualms remembering 100 blocks of 5k. It also has no qualms remembring 100 blocks of 1. It has huge qualms, in that sense, about remembering one block of 5k and 100 blocks of 1. After the 100th block of 1, it will dump that one block of 5k that preceded it.

Not only is this just stupid in terms of remembering what is important, or remembering it in a way that makes sense for getting text back, it also makes undoing typed text a character-by-character process when other programs would usually undo in blocks (by word, for example, or by group of words).

Now this was the same in OpenOffice and just hasn't been changed since.

I just can't help but think it is not a very good idea to do it in this way.

Most other program I know internally merge the characters into words when remembering them.

So say you write a word and a word boundary.

Then the next word and word boundary you write will cause the engine to look back into the undo buffer and check the previous word boundary, then merge everything in between into one word undo.

Or, likewise, or conversely, it can put every character you type into the previous undo buffer so you can only undo words that are delimited by a word boundary (or interspersed and as such delimited by other actions such as deletes or pastes or whatever).

Then when the next word is reached, a new undo buffer is created for that new word. But I think most programs actively rewrite their history to group characters into words and words into blocks of words. They do this to have a sort of logarithmic view on the undo history in which older events get grouped together into bigger writes, while more recent events are kept smaller.

If you also remember a time stamp with each undo block then it is rather easy also to merge blocks of words based on time. But it gets more complicated that way.

A simple heuristic of "more than 8 words in the past: group the preceding block of 8 words into one buffer. Have started a new paragraph? turn the paragraph before the previous into one block.

I don't know how people usually do it. But most any program has it. You could even look at the algo for Webkit/Chromium, or Kate, for all you cared.

Maybe they even use common libraries for it. It's just that it's not that hard to do it yourself and if your engine even supported the minimum which would be grouping into words, you would already get very far. Now your buffer of 100 steps is 100 words instead of 100 characters, mostly.

And that really doesn't take any memory okay.

Such a rewrite of the previous word could probably done in less than a 100 clock cycles ;-).

Well, if you did it in assembler.

Not saying I can do it.

Just saying it is not going to be a performance hindrance.

I also cannot really imagine the amount of memory required for words as opposed to single characters is going to make a dent in your memory consumption.

Most of the memory you require is overhead anyway, probably, for such small chunks.

Anyway.

--
To unsubscribe e-mail to: users+unsubscribe@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.