You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Opening a binary file and trying to save it after using :HexToggle breaks the executable.
The problem stems from the binary being opened as a regular file, since the plugin cannot determine that the file is a binary due to missing file extension and not being opened with the -b flag.
From the VIM docs, this will likely break the file due to wrong handling.
This is likely a user error since the flag should be provided when opening the file but (some) users likely don't know about this behavior.
Proposed Fix
Set the buffer as "binary" when calling dump_to_hex.
vim.bo.bin = true
I can prepare a PR for this if you'd like.
Steps to Reproduce
Prepare Binary
Compile the following content with gcc -o run main.c.
Overview
Opening a binary file and trying to save it after using
:HexToggle
breaks the executable.The problem stems from the binary being opened as a regular file, since the plugin cannot determine that the file is a binary due to missing file extension and not being opened with the
-b
flag.From the VIM docs, this will likely break the file due to wrong handling.
This is likely a user error since the flag should be provided when opening the file but (some) users likely don't know about this behavior.
Proposed Fix
Set the buffer as "binary" when calling
dump_to_hex
.I can prepare a PR for this if you'd like.
Steps to Reproduce
Prepare Binary
Compile the following content with
gcc -o run main.c
.Executing the binary prints "hello", as expected.
Save Binary
nvim run
:HexToggle
(hexdump content still correct):w
The binary is broken after step 3.
Trying to execute the binary now gives the output
The text was updated successfully, but these errors were encountered: