Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Viewer in hex mode sometimes shows "-" incorrectly #3901

Open
mc-butler opened this issue Feb 18, 2018 · 4 comments
Open

Viewer in hex mode sometimes shows "-" incorrectly #3901

mc-butler opened this issue Feb 18, 2018 · 4 comments
Labels
area: mcview mcview, the built-in text editor prio: medium Has the potential to affect progress

Comments

@mc-butler
Copy link

Important

This issue was migrated from Trac:

Origin https://midnight-commander.org/ticket/3901
Reporter zaytsev (@zyv)
Mentions egmont (@egmontkob)

Forwarded from Ubuntu bug tracker:

https://bugs.launchpad.net/ubuntu/+source/mc/+bug/1750239

Curious bug of "View Hex":
Depending on the name of a file (with or without extension .2)
      and on the directory(!)
the internal viewer with the hex option shows
the 1-byte ASCII character "-"
    as (incorrectly) as 3 bytes "E2 80 90"
    or (correctly) as 1 byte "2D".
This is demonstrated by screen shots taken with a 6-byte file,
but was discovered accidently with a larger file.

I could reproduce this on mc 4.8.20 with the attached sample.

Note

Original attachments:

@mc-butler
Copy link
Author

Changed by zaytsev (@zyv) on Feb 18, 2018 at 19:11 UTC

@mc-butler
Copy link
Author

Changed by egmont (@egmontkob) on Feb 18, 2018 at 20:09 UTC (comment 1)

Open with Shift+F3, or press F8 to switch to Raw mode and it's displayed as 2D as expected.

E2 80 90 is U+2010 Hyphen, as probably the *roff pipeline interpreting and converting the file (believing it's a manpage due to its ".2" extension).

@mc-butler
Copy link
Author

Changed by psch (peter.schmitt@….ac.at) on Feb 18, 2018 at 20:32 UTC (comment 2)

This explains it, but only partially: How can this depend on the directory in which the file resides?

Furthermore, I think that "Hex" _always_ should use the "raw" file (at least by default)
-- what could be the reason to look at an interpretation in hex mode?

In general, it might be helpful and avoid confusion if mc would indicate it somehow
when interpretation is in force.

@mc-butler
Copy link
Author

Changed by egmont (@egmontkob) on Feb 18, 2018 at 21:05 UTC (comment 2.3)

Replying to psch:

This explains it, but only partially: How can this depend on the directory in which the file resides?

ext.d/text.sh seems to provide the explanation at the top of do_view_action(). If the file looks like a manual page (based on its extension I guess) then checks if it's under a "log" or "logs" directory. If so, it simply cats it, otherwise sends through manpage formatting. This is probably in order to filter out logrotate files (under /var/log and similar standard places) from being mishandled as manpages.

Furthermore, I think that "Hex" _always_ should use the "raw" file (at least by default)
-- what could be the reason to look at an interpretation in hex mode?

Independently of this particular issue, this may (or may not, up to discussion) be a valid feature request.

Or, we might think of whitelisting directories potentially containing manpages, instead of blacklisting the log ones.

In general, it might be helpful and avoid confusion if mc would indicate it somehow
when interpretation is in force.

You can see it in the bottom at "8 Raw". Not sure what could / should be a more prominent way of showing it.

(On a somewhat related note:

I loathe that user interface designers have for decades failed to figure out whether a button should show the current state, or the state it switches to. E.g. in mcview's F2, F8 and F9 in the bottom bar, I'm always getting confused as it displays what the button would take me to, it would be much more intuitive _for me_ to see the current status.

Look at youtube videos. The play/pause button shows what it would do, that is, the opposite of the current playing/paused state. Second next to that, the volume button shows whether speakers are enabled or disabled at the moment, that is, the opposite of what pressing the button does.

There are sure zillions of other similar examples...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: mcview mcview, the built-in text editor prio: medium Has the potential to affect progress
Development

No branches or pull requests

1 participant