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

Binary files are not displayed properly after tab change #14832

Open
u07 opened this issue Mar 6, 2024 · 14 comments
Open

Binary files are not displayed properly after tab change #14832

u07 opened this issue Mar 6, 2024 · 14 comments

Comments

@u07
Copy link

u07 commented Mar 6, 2024

Description of the Issue

Hi. After updating NPP I found out that I can't edit binary files anymore. They open normally, but then if I switch to another file (another tab) and go back, NPP freezes and then shows the binary file stripped from all non-printable symbols.

In the newest version same happens when I open binary via Explorer context menu -> Open in NPP. The only way to view it correctly is to drag it into NPP window.

Steps to Reproduce the Issue

  1. open file
  2. open another tab
  3. go back to the file

Expected Behavior

Actual Behavior

image
image
image

Debug Information

Notepad++ v8.6.4 (64-bit)
Build time : Feb 20 2024 - 00:12:59
Path : C:\Program Files\Notepad++\notepad++.exe
Command Line :
Admin mode : ON
Local Conf mode : OFF
Cloud Config : OFF
OS Name : Windows 7 Professional (64-bit)
OS Build : 7601.0
Current ANSI codepage : 1251
Plugins : none

@alankilborn
Copy link
Contributor

Notepad++ is a text editor, not a true hex editor.
Suggest you use a hex editor for work with non-text files.

@u07
Copy link
Author

u07 commented Mar 6, 2024

I used to work with it like this, it's been fine for ages. It pretty much is hex- or whatever- super-duper multi editor)

Actually, I think, I found the problem. What is this param ccShow="No"? Where is it in the config window? It seems not available via GUI. Although, in my setup (after update) it is NO. And in a fresh new install it is YES. And when it's YES, the problem is gone

@u07
Copy link
Author

u07 commented Mar 6, 2024

image

@alankilborn
Copy link
Contributor

ccShow

Probably relating to one of these:

image


It pretty much is hex- or whatever- super-duper multi editor

If you don't have NUL in your data, it is "pretty much ok".
But... you do have NUL in there, so, a lot of Notepad++ editing actions will not work correctly. You're playing with fire. Good luck to not get burned.

@u07
Copy link
Author

u07 commented Mar 6, 2024

Ah, I see.. it's linked with this button now. It's behaviour is inconsistent, it has 3 states instead of 2. By default CCs are enabled, button is Off. Then you click it and it's On - CCs are still enabled. Then you declick it and CCs are gone.

I can't remember, was it the default behaviour in previous versions? This button used to (?) disable spaces and tabs only, not CCs.

image

image

image

@u07
Copy link
Author

u07 commented Mar 6, 2024

Similar issue: #13988

@alankilborn
Copy link
Contributor

As you point out, 13988 is a similar issue. I'd forgotten about that one.

Regarding the ¶ toolbar button, it is intended to be an "all on" or "all off" control.
If the button is in the depressed/on state (visually), you can be sure it is showing the maximum that can be shown.
However, if it is in the non-depressed/off state, it might not be the minimum (all off), but it definitely isn't the maximum (all on).
If you exclusively use the toolbar button for control, however, you can be sure that it is all-on or all-off.
(it isn't the most obvious behavior)

@alankilborn
Copy link
Contributor

Regarding the ¶ toolbar button

More information regarding this button was added to the user manual: https://github.com/notepad-plus-plus/npp-usermanual/pull/646/commits

@u07
Copy link
Author

u07 commented Mar 7, 2024

I got your idea. But still believe it's a wrong approach. That's why:

  • First, in other editors same button is normally used for displaying invisible characters only. Like, tabs, spaces and paragraphs. The icon itself represents the paragraph symbol. Look at MS Word: disarmed btn & visible CCs:

image

  • Second, the behaviour of this button was different in previous versions of NPP. It used to work as you expected it to work based on your experience with any other editor. See:

output

  • Third, showing TABs ans spaces is a more essential and popular function than hiding CCs. Normally you don't have CCs in your document, and if you have, you probably need them visible.

I believe that the behaviour of the button was changed unintentionally. Someone added a new functionality allowing user to hide control characters. And he placed it into the submenu that was controlled by that button. So the button got this new function. As there's a bug related to that change, it may prove me right, the programmer just did it without noticing this hidden impact. At least I haven't found any related discussions.

@alankilborn
Copy link
Contributor

  • Second, the behaviour of this button was different in previous versions of NPP. It used to work as you expected it to work based on your experience with any other editor. See:

I see what is happening for you in your animated screen capture in your "Second" bullet point.
Unfortunately, when I attempt to reproduce that behavior, I can't.
For me, when the toolbar button is shown in the depressed state, I see all of the inverse video characters.
When it is in the not-depressed state, I see none of the inverse video characters.
For me, I am obtaining "correct" behavior, so, sorry, I can't be of more help on that aspect -- maybe someone else?

@u07
Copy link
Author

u07 commented Mar 7, 2024

when I attempt to reproduce that behavior, I can't

Of course, you can't. That is classic NPP behaviour from previous versions (v6 will do). It used to work like that from the beginning of the project. But it changed recently when that new menu item was added.

@u07
Copy link
Author

u07 commented Mar 7, 2024

Btw, here is the commit: 0cad36d , April 11 2023 by @ozone10 .

Long story short: donho decided (#13324) to change the "Show All Characters" button behaviour...

Now there is a quick way to DISABLE CCs with the "Show All Characters" button. But to ENABLE them back you have to go to a menu and then a submenu. And yeah, you'll have to google it first:

image

@alankilborn
Copy link
Contributor

alankilborn commented Mar 7, 2024

Of course, you can't. That is classic NPP behaviour from previous versions (v6 will do)

Ah, I misunderstood.

Anyway, the behavior is 8.6.4 (of the button) is as the developers desire. And it's fine with me as well. Not sure how many users would be on your side (impossible to know, unless they comment here).

@alankilborn
Copy link
Contributor

For users that desire some alternative functionality to how the toolbar button works, you can create some macro(s) and bind them to keycombo(s) for quick access.

For example, here are two possible macros (that could be added into shortcuts.xml):

    <Macro name="View ShowSymbol: show eol and control chars" Ctrl="no" Alt="no" Shift="no" Key="0">
        <Action type="2" message="0" wParam="44019" lParam="0" sParam="toggle ShowAllChars (cannot know which state it is in after this)" />
        <Action type="2" message="0" wParam="44025" lParam="0" sParam="toggle ShowSpaceAndTab; this will definitely uncheckmark ShowAllChars" />
        <Action type="2" message="0" wParam="44019" lParam="0" sParam="checkmark ShowAllChars (and all others will become checkmarked too)" />
        <Action type="2" message="0" wParam="44019" lParam="0" sParam="uncheckmark ShowAllChars (and all others will become uncheckmarked too)" />
        <Action type="2" message="0" wParam="44026" lParam="0" sParam="checkmark ShowEndOfLine" />
        <Action type="2" message="0" wParam="44131" lParam="0" sParam="checkmark ShowControlChars" />
    </Macro>
    <Macro name="View ShowSymbol: show everything except eol" Ctrl="no" Alt="no" Shift="no" Key="0">
        <Action type="2" message="0" wParam="44019" lParam="0" sParam="toggle ShowAllChars (cannot know which state it is in after this)" />
        <Action type="2" message="0" wParam="44025" lParam="0" sParam="toggle ShowSpaceAndTab; this will definitely uncheckmark ShowAllChars" />
        <Action type="2" message="0" wParam="44019" lParam="0" sParam="checkmark ShowAllChars (and all others will become checkmarked too)" />
        <Action type="2" message="0" wParam="44026" lParam="0" sParam="uncheckmark ShowEndOfLine" />
    </Macro>

Some notes on the macros:

  • As sParam is unused for these commands, I've used it to embed some comments about the steps in the macros.

  • The first 3 actions in the macros are the same; after these 3 actions it is guaranteed that all of the View > Show Symbol choices are checkmarked. Macro logic can then continue from there to set or clear the various choices.

  • I haven't bound any keycombos to these macros; that would be up to the user to decide on keycombos and then set that up.

Here are the command ids for the possible commands:

  • Show Space and Tab : 44025
  • Show End of Line : 44026
  • Show Non-Printing Characters : 44130
  • Show Control Characters & Unicode EOL : 44131

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants