4 ms·
"Frankly", I'm always willing to learn: Any facts to back up your claims?
by jlg23 9y ago
"Frankly", I'm always willing to learn: Any facts to back up your claims?
- msla 9y agohttps://softwareengineering.stackexchange.com/questions/311015/how-is-curses-a-pun-for-cursor-optimization https://softwareengineering.stackexchange.com/questions/3110... > Part of what curses does is optimize cursor control sequences so (for example) to backspace all the way to the beginning of a line, instead of writing out a bunch of back-space characters, it can issue one command to move the cursor to the beginning of the line, and one more to erase to the end of the line. For more detail, there's the source code. http://invisible-island.net/ncurses/ http://invisible-island.net/ncurses/
- hellerve 9y agoANSI can do it in one escape sequence: "CSI2K". https://en.wikipedia.org/wiki/ANSI_escape_code https://en.wikipedia.org/wiki/ANSI_escape_code
- clarry 9y agoIndeed. There really is not much screen update "optimization" to do in implementing an editor. It's really quite a no-brainer to keep track of updates to a line, and only update the tail that changed. And that's pretty much all it takes to keep it running smoothly over serial. I don't have my code handy right now but all the screen handling amounts to maybe a couple hundred lines of code, out of many thousand.
- jlg23 9y agoI asked for a point, not for a pointer to source code. I can RTFS myself, but after 20+ years of reading and writing code relevant to the question: again, do you have an actual point?
- zeveb 9y agoWithout looking at the source code, I wonder to what extent it succeeds at that goal. Does it actually contain a platform-independent state machine, and diff the current state against the last-known state in order to issue updates, or does it use heuristics to figure out how to reduce control sequences?