4 ms·
While chunking data, it's non-trivial to handle fast scrolling and populating the scrollbars with the correct size of what the eventual size would be.
by keehun 6y ago
While chunking data, it's non-trivial to handle fast scrolling and populating the scrollbars with the correct size of what the eventual size would be.
- comex 6y agoNon-trivial for sure. But much easier with a hex editor than with, say, a standard text editor. No need to guess how many lines some text takes up due to word wrapping; no need to even search for newlines. There's a fixed number of bytes per row, and a fixed row height, so mapping between byte offset, line number, and pixel y-position is just a matter of multiplying and dividing.
- keehun 6y agoAgree. Nothing to argue there.
- ttt0 6y agoI might be wrong, but I believe the fastest way is to seek to the end of file and that way you can get the total file size. Or use like fstat or something Maybe scrolling is non trivial, but there is definitely a lot of room for optimizations. You could store large chunks in memory and populate them asynchronously with smaller chunks from file for example. edit: I completely missed the point with the size, comex's answer is way better
- IshKebab 6y agoWhy is it non-trivial? Each line shows a fixed amount of data, and you know the total amount of data. Sounds pretty trivial to me.