Page 1 of 1

Lister: upgrade scrollbar style in text mode

Posted: 2021-05-10, 18:46 UTC
by Slavic
Current look of Lister's scrollbar in the text and hex modes reminds the old good times of Windows 3.1. Its scroll box (sometimes called a thumb) has the fixed size similar to buttons at the ends of the scrollbar. Contrary, scrollbars built in the TC panels and Lister's scrollbars for pictures have more contemporary look.

I guess that it's a result of the old TC heritage. Maybe fixing this part of code wouldn't be too hard. Besides the consistent look of scrollbars in different areas, the modern scrollbar is much more handy and informative than the old one, text viewing is not an exemption.

Re: Lister: upgrade scrollbar style in text mode

Posted: 2021-05-11, 09:04 UTC
by ghisler(Author)
No, the reason is different: Lister doesn't know how many lines a file has. It would have to read the entire file just to get that information. But this information would be needed to show a thumb button with a size proportional to the currently shown part of the file. Instead, when you use the thumb button, Lister scrolls to the percentage of the position. For example, when you move the thumb button to 30% down, Lister scrolls to 30% of the length of the file.

Re: Lister: upgrade scrollbar style in text mode

Posted: 2021-05-11, 10:06 UTC
by Slavic
Yes, I understand the logics: generally, Lister doesn't read the entire file, unlike all text editors do, so it cannot calculate the part of the text shown on the Lister's screen. So, keeping the current scrollbar look may be reasonable.

However, I see two possible exceptions:
1. If the file is not large and Lister may read it whole to the internal buffer, so the number of the text lines can be calculated;
2. Lister is in hex (binary) mode, when the part of the file shown on the screen is known and isn't changed while scrolling, even for large file.

For such files or viewing mode the modern scrollbar would be nice to have, if it will not require too much changes in the code.

Re: Lister: upgrade scrollbar style in text mode

Posted: 2021-05-11, 12:58 UTC
by Usher
Slavic wrote: 2021-05-11, 10:06 UTC Lister doesn't read the entire file, unlike all text editors do
Wrong. Unlike many text editors do. See for example this article: https://www.ghacks.net/2018/02/22/how-to-open-gigabyte-sized-text-files-on-windows/