Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Graal V4 Main Forum (https://forums.graalonline.com/forums/forumdisplay.php?f=143)
-   -   Request: Undo (https://forums.graalonline.com/forums/showthread.php?t=61186)

napo_p2p 09-13-2005 09:23 AM

Request: Undo
 
Would it be possible to have the GuiMLTextCtrls, and even the GuiTextCtrls to have undo capability? A big undo stack would be nice :) .

calani 09-13-2005 10:07 PM

already requested and ignored twice =(
oh, and another thing that would be nice:
ctrl+left/right (word left/right) and ctrl+shift+left/right (select word left/right)



444th post :redface:

Admins 09-14-2005 01:43 AM

GuiTextCtrl already has (simple) undo, word-selection will be added soon, undo for multiline edit control is a little bit more complicated so it will take more time

ChibiChibiLuc 09-14-2005 04:31 AM

Would it be possible to make a command that highlights text?

i.e. highlightText(pos1, pos2)

calani 09-14-2005 05:27 AM

and set cursor positon
possibly also setfocus? (as long as it doesn't set the main graal window focus -.-)

and as for the undo's.. it wouldn't be that hard.
just make a small log of everything that's changed
so to undo/redo, all you need to do is parse the next entry in the log.
the format would be simple enough
(action) (row) (col) [to (row) (col)] (data)
ex. "replace 5 0 to 6 4 hello\nworld\n"
or "delete 5 0 "hello\nworld\n"

the same would go for single line text edit boxes. the only difference is keeping track of the rows wouldn't be necessary

Skyld 09-14-2005 06:33 PM

Quote:

Originally Posted by calani
and set cursor positon
possibly also setfocus? (as long as it doesn't set the main graal window focus -.-)

and as for the undo's.. it wouldn't be that hard.
just make a small log of everything that's changed
so to undo/redo, all you need to do is parse the next entry in the log.
the format would be simple enough
(action) (row) (col) [to (row) (col)] (data)
ex. "replace 5 0 to 6 4 hello\nworld\n"
or "delete 5 0 "hello\nworld\n"

the same would go for single line text edit boxes. the only difference is keeping track of the rows wouldn't be necessary

I am not sure about your method (you would most likely get a lot of memory being wasted), but I do agree that having undo in GUI controls is a good idea.

calani 09-15-2005 03:31 AM

Quote:

Originally Posted by Skyld
you would most likely get a lot of memory being wasted

on the contrary, it is actually very memory efficient.
especially as there is usually only a few edit boxes active at any one time.
plus, you could further squish the format anyways
r:5,0,6,4:hello\nworld\n (24 bytes)
d:5,0:hello\nworld\n (20 bytes)

also, think about it. how many undos are usually active in the buffer anyways? most are just adds. in theory, adding a lengthy undo buffer using a log would maybe double the amount of memory used for the control, plus the header part for each entry. it might increase it by 2 1/2 times at the most, which isn't really that much considering what's usually in them... say less than 500 bytes worth of data. If, however, its a short novel or a lengthy script (say the max script size of 64k) then it would be a considerable increase (64k+64k+64k or 192k in this example). that, though, is worst-case. on average (say, 250b -> 750b), it wouldn't be that noticable.

( 72 undos used in this edit :D lineup: 59 adds, 2 deletes, 11 replaces)

napo_p2p 09-15-2005 08:25 AM

Quote:

Originally Posted by calani
that, though, is worst-case. on average (say, 250b -> 750b), it wouldn't be that noticable.

And, I assume, that memory would only be used when a GuiMLTextCtrl is open.

calani 09-15-2005 07:02 PM

Quote:

Originally Posted by nano_p2p
And, I assume, that memory would only be used when a GuiMLTextCtrl is open [visible].

likely yes, or until the control is destroyed.


All times are GMT +2. The time now is 08:53 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.