Fiendish said:
And srsly, we need the simplicity of spawning efficient resizable scrolling (real) windows that aren't hacks on top of a very base layer to get serious about development. The whole time I spent on the capture window my girlfriend was bugging me "Don't operating systems usually give that stuff (window dressing) to you already?" I was like, "Yeah, but here I only get pixels and text and mouse events!"
Even in the core MUSHclient code (the C++ stuff) I don't attempt to rewrap if you resize the output window. Recalculating wrap boundaries for potentially hundreds of thousands of lines is going to be slow, in any language.
Fiendish said:
Someone should request as a feature the ability to get the colors of captured text in a more efficient manner. Looping through loops of loops just because we don't have access to the color code for each character kinda sucks.
Actually, storing style runs is more efficient than storing a "color code for each character". For one thing, each character has a foreground colour (R/G/B which is 3 bytes) plus a background colour (another 3 bytes) plus bold/underline etc. So if you stored it "per character" you would be using something like 8 bytes per character (the character itself, + 3 foreground, +3 background, +1 style).
Then even if I gave you that information, per character, you would then have to replace calling WindowText once (for a whole lot of consecutive bytes, all the same colour) with lots of calls, which itself is slower. Imagine, instead of a single call to display 80 bytes, all white on black, you had to do 80 calls! And then that defeats text kerning, where the text output routines might kern and anti-alias based on adjacent letters.
So you may end up with a slower result, and one in which the text looked worse.
Remember, the miniwindows were initially designed to give scripters what they didn't have in the text client, namely:
- Status bars
- Action buttons
- Pop-up windows (eg. inventory items)
- Images (eg. maps)
- Some text capability (eg. for labels)
Providing scrolling text, with text wrapping like a word processor, was not high on the design agenda.
And indeed Fiendish, you have demonstrated it can be done, and done very well. You don't have to wrap everything after all, just the visible parts. And the player probably won't resize every couple of seconds, so they may tolerate a brief delay if they do. |