flat assembler
Message board for the users of flat assembler.
Index
> Projects and Ideas > Scrollbar update strategy? |
Author |
|
revolution 19 Dec 2011, 20:46
At load time scan the file once and build a sorted tree of line lengths. As each line changes length update the tree. The last (or first) entry in the tree always has the length of the longest line. Something like a red-black tree would be suitable but check out other types of trees to see if another one looks like a better fit.
|
|||
19 Dec 2011, 20:46 |
|
JohnFound 19 Dec 2011, 21:56
revolution, I can't imagine what the tree structure will help me about this problem. What this tree will contain - only lengths or pointers to the text lines. Or text lines must contain pointers to the tree nodes?
|
|||
19 Dec 2011, 21:56 |
|
Tomasz Grysztar 19 Dec 2011, 22:05
fasmw's AsmEdit control does that by keeping an array of line counts for each length. Each time the line's length changes, the count for its earlier length is decreased, and count for the new length is increased - if it decreases the count for current maximum length and it becomes zero, it looks for the previous non-zero count in the array.
|
|||
19 Dec 2011, 22:05 |
|
JohnFound 19 Dec 2011, 22:18
Hi Tomasz. This is exactly the solution I wanted to use at first glance. The only thing that makes me think again is that the length of the array makes some limit to the possible lengths of lines. So, even if we have one line 10000 chars, we must have array from 10000 elements. (filled mostly with zeroes).
Last edited by JohnFound on 19 Dec 2011, 22:29; edited 1 time in total |
|||
19 Dec 2011, 22:18 |
|
Tomasz Grysztar 19 Dec 2011, 22:22
If you already have one line with 10000 chars, then the table would be only four times the length of that line. And since generally (because of its architecture) AsmEdit already uses few times more memory for text storage than the length of the pure text itself (in case when it consists of short lines - the longer lines you have, the less waste there is then), this seemed like not a problem for me. But of course it all depends on your design and priorities. revolution's tree proposal may be the right one for you if you don't like the idea of huge mostly-zero array happening sometimes.
|
|||
19 Dec 2011, 22:22 |
|
revolution 19 Dec 2011, 22:33
JohnFound wrote: revolution, I can't imagine what the tree structure will help me about this problem. What this tree will contain - only lengths or pointers to the text lines. Or text lines must contain pointers to the tree nodes? |
|||
19 Dec 2011, 22:33 |
|
JohnFound 19 Dec 2011, 22:37
Also, I think about absolutely different approach - simply to not adjust the scrollbar related to the whole text, but only to the current displayed page. Or maybe to the three pages - previous, current and next.
This approach will make easy to simply search the maximum from the limited number of lines. Also, it could be even more convenient for the user, because it will allow scrolling of the lines that the user can see at the moment. For example, if there is a very long line at the begin of the text and the user drags the scrollbar to the end, he will end with totally useless blank screen. |
|||
19 Dec 2011, 22:37 |
|
revolution 19 Dec 2011, 22:43
JohnFound wrote: Also, I think about absolutely different approach - simply to not adjust the scrollbar related to the whole text, but only to the current displayed page. Or maybe to the three pages - previous, current and next. |
|||
19 Dec 2011, 22:43 |
|
JohnFound 19 Dec 2011, 22:49
There will be no horizontal movement of the text when you scroll vertically. Only the position and size of the slider relative to the scrollbar will change, not the text itself.
|
|||
19 Dec 2011, 22:49 |
|
revolution 19 Dec 2011, 22:52
JohnFound wrote: There will be no horizontal movement of the text when you scroll vertically. Only the position and size of the slider relative to the scrollbar will change, not the text itself. |
|||
19 Dec 2011, 22:52 |
|
AsmGuru62 20 Dec 2011, 04:31
In Visual Studio editor - the scroll bar is set to some large value (like 1024) and it is never adjusted - a simplest solution. Practice shows that long lines of code are unreadable.
|
|||
20 Dec 2011, 04:31 |
|
edfed 05 Jan 2012, 17:01
give a chance the asmedit.inc engine? or inspire yourself from it, it is a very powerfull and smart piece of code.
|
|||
05 Jan 2012, 17:01 |
|
JohnFound 06 Jan 2012, 07:08
edfed wrote: give a chance the asmedit.inc engine? or inspire yourself from it, it is a very powerfull and smart piece of code. Agree, the current editor of Fresh is based on FASMW, but in its current state it can't provide some features I want to implement (and almost implemented): 1. UNICODE support. 2. Code folding. 3. Full portability. 4. Word wrap. 5. Full GUI level portability. 6. Saveable bookmarks, breakpoints and other format info. 7. Line associated debug information. |
|||
06 Jan 2012, 07:08 |
|
typedef 06 Jan 2012, 21:48
^^One man doing that ? Good luck. Do you work ?
UNICODE support IMO is more demanding than most of them. |
|||
06 Jan 2012, 21:48 |
|
JohnFound 07 Jan 2012, 09:26
typedef, the engine it is almost done. Including UNICODE support for both Linux and Windows. There are some features that have to be finished.
You can see some (outdated) screenshots here. |
|||
07 Jan 2012, 09:26 |
|
typedef 07 Jan 2012, 20:54
It's nice to see ppl stay devoted to open source even in times of economic turmoil.
|
|||
07 Jan 2012, 20:54 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.