Lister: some garbage at the end of text

The behaviour described in the bug report is either by design, or would be far too complex/time-consuming to be changed

Moderators: white, Hacker, petermad, Stefan2

Post Reply
Slavic
Senior Member
Senior Member
Posts: 290
Joined: 2006-02-26, 15:41 UTC
Location: Montenegro

Lister: some garbage at the end of text

Post by *Slavic »

From time to time I noticed that Lister can show sometimes a wrong output and even garbage, but this occurs rarely and is difficult to reproduce. Luckily, I have caught one case.

File: package.xml (it's some Microsoft's script in UTF-8 format)

Open the file in Lister (UTF-8 mode will be set automatically, you can switch to plain text, no mean) and go to end of text. Then press "PageDown" and see the garbage at the bottom of window. You can press "arrow down" several times and even attempt to select the invisible (?) area.

Image: http://www.fileden.com/files/2006/6/7/54504/test/garbage.png
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Indeed that's a case which lister cannot handle: A relatively large text file with no line breaks at all. The only way to show this file properly is in binary or hex mode.
Author of Total Commander
https://www.ghisler.com
Slavic
Senior Member
Senior Member
Posts: 290
Joined: 2006-02-26, 15:41 UTC
Location: Montenegro

Post by *Slavic »

Yes, I understand.

Of course, it would be nice if Lister will be able to predict such situations using internal AI and suggest the binary view mode instead. For example, if the file is expected to be a text, Lister can scan first, say, 5000 characters (about one printed page) for line breaks. If yes, it's a common text, which will be shown as Text or UTF-8. If no, this is supposedly a kind of program script that I attached and would be better shown as binary.

It's a simple heuristic check, you can realize something more sophisticated. By the way, there are some writers or kind of literature using the style with extremely large paragraphs, several pages or more - for example, J. Kerouac (however, it's a special case :))
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

It doesn't work because of how Lister works: It reads a small part of the file (64k) around the current position, and then looks for line breaks near that position. Your file is larger than that block size and doesn't contain any line breaks, so Lister fails to handle it properly.
Author of Total Commander
https://www.ghisler.com
Post Reply