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

Visual glitches when displaying binary file #12882

Open
adam-jw-casey opened this issue Feb 15, 2025 · 5 comments
Open

Visual glitches when displaying binary file #12882

adam-jw-casey opened this issue Feb 15, 2025 · 5 comments
Labels
C-bug Category: This is a bug

Comments

@adam-jw-casey
Copy link

adam-jw-casey commented Feb 15, 2025

Summary

Opening a binary file results in visual bugs. It seems like lines are overflowing into the next line.

I know that helix is not intended for editing binary files, but a user might still open a binary by accident (like I did) or want to look for strings and such interactively in a binary. neovim handles this gracefully and helix should too.

Image

Reproduction Steps

Steps to reproduce

  1. Open a binary file* in helix.
  2. Observe that the view is broken up:

Image

*I encountered this specifically with a FreeCAD file (.FCBak) - I expect other binary files would have the same effect but I haven't tested it.

I've attached an example file in a comment below.

Helix log

Nothing in the log jumps out as interesting but I'm including it anyways.

~/.cache/helix/helix.log
2025-02-15T11:17:28.084 globset [DEBUG] glob converted to regex: Glob { glob: "*/Dockerfile.*", re: "(?-u)^.*/Dockerfile\\..*$", opts: GlobOptions { case_insensitive: false, literal_separator: false, backslash_escape: true, empty_alternates: false }, tokens: Tokens([ZeroOrMore, Literal('/'), Literal('D'), Literal('o'), Literal('c'), Literal('k'), Literal('e'), Literal('r'), Literal('f'), Literal('i'), Literal('l'), Literal('e'), Literal('.'), ZeroOrMore]) }
2025-02-15T11:17:28.084 globset [DEBUG] glob converted to regex: Glob { glob: "*/dockerfile.*", re: "(?-u)^.*/dockerfile\\..*$", opts: GlobOptions { case_insensitive: false, literal_separator: false, backslash_escape: true, empty_alternates: false }, tokens: Tokens([ZeroOrMore, Literal('/'), Literal('d'), Literal('o'), Literal('c'), Literal('k'), Literal('e'), Literal('r'), Literal('f'), Literal('i'), Literal('l'), Literal('e'), Literal('.'), ZeroOrMore]) }
2025-02-15T11:17:28.084 globset [DEBUG] glob converted to regex: Glob { glob: "*/Containerfile.*", re: "(?-u)^.*/Containerfile\\..*$", opts: GlobOptions { case_insensitive: false, literal_separator: false, backslash_escape: true, empty_alternates: false }, tokens: Tokens([ZeroOrMore, Literal('/'), Literal('C'), Literal('o'), Literal('n'), Literal('t'), Literal('a'), Literal('i'), Literal('n'), Literal('e'), Literal('r'), Literal('f'), Literal('i'), Literal('l'), Literal('e'), Literal('.'), ZeroOrMore]) }
2025-02-15T11:17:28.084 globset [DEBUG] glob converted to regex: Glob { glob: "*/containerfile.*", re: "(?-u)^.*/containerfile\\..*$", opts: GlobOptions { case_insensitive: false, literal_separator: false, backslash_escape: true, empty_alternates: false }, tokens: Tokens([ZeroOrMore, Literal('/'), Literal('c'), Literal('o'), Literal('n'), Literal('t'), Literal('a'), Literal('i'), Literal('n'), Literal('e'), Literal('r'), Literal('f'), Literal('i'), Literal('l'), Literal('e'), Literal('.'), ZeroOrMore]) }
2025-02-15T11:17:28.084 globset [DEBUG] glob converted to regex: Glob { glob: "*/.*ignore", re: "(?-u)^.*/\\..*ignore$", opts: GlobOptions { case_insensitive: false, literal_separator: false, backslash_escape: true, empty_alternates: false }, tokens: Tokens([ZeroOrMore, Literal('/'), Literal('.'), ZeroOrMore, Literal('i'), Literal('g'), Literal('n'), Literal('o'), Literal('r'), Literal('e')]) }
2025-02-15T11:17:28.084 globset [DEBUG] glob converted to regex: Glob { glob: "*/BUILD.*", re: "(?-u)^.*/BUILD\\..*$", opts: GlobOptions { case_insensitive: false, literal_separator: false, backslash_escape: true, empty_alternates: false }, tokens: Tokens([ZeroOrMore, Literal('/'), Literal('B'), Literal('U'), Literal('I'), Literal('L'), Literal('D'), Literal('.'), ZeroOrMore]) }
2025-02-15T11:17:28.084 globset [DEBUG] glob converted to regex: Glob { glob: "*/.env.*", re: "(?-u)^.*/\\.env\\..*$", opts: GlobOptions { case_insensitive: false, literal_separator: false, backslash_escape: true, empty_alternates: false }, tokens: Tokens([ZeroOrMore, Literal('/'), Literal('.'), Literal('e'), Literal('n'), Literal('v'), Literal('.'), ZeroOrMore]) }
2025-02-15T11:17:28.084 globset [DEBUG] glob converted to regex: Glob { glob: "*/.envrc.*", re: "(?-u)^.*/\\.envrc\\..*$", opts: GlobOptions { case_insensitive: false, literal_separator: false, backslash_escape: true, empty_alternates: false }, tokens: Tokens([ZeroOrMore, Literal('/'), Literal('.'), Literal('e'), Literal('n'), Literal('v'), Literal('r'), Literal('c'), Literal('.'), ZeroOrMore]) }
2025-02-15T11:17:28.084 globset [DEBUG] glob converted to regex: Glob { glob: "*/conf/*/*.{inc,conf}", re: "(?-u)^.*/conf/.*/.*\\.(?:conf|inc)$", opts: GlobOptions { case_insensitive: false, literal_separator: false, backslash_escape: true, empty_alternates: false }, tokens: Tokens([ZeroOrMore, Literal('/'), Literal('c'), Literal('o'), Literal('n'), Literal('f'), Literal('/'), ZeroOrMore, Literal('/'), ZeroOrMore, Literal('.'), Alternates([Tokens([Literal('c'), Literal('o'), Literal('n'), Literal('f')]), Tokens([Literal('i'), Literal('n'), Literal('c')])])]) }
2025-02-15T11:17:28.084 globset [DEBUG] glob converted to regex: Glob { glob: "*/Jenkinsfile.*", re: "(?-u)^.*/Jenkinsfile\\..*$", opts: GlobOptions { case_insensitive: false, literal_separator: false, backslash_escape: true, empty_alternates: false }, tokens: Tokens([ZeroOrMore, Literal('/'), Literal('J'), Literal('e'), Literal('n'), Literal('k'), Literal('i'), Literal('n'), Literal('s'), Literal('f'), Literal('i'), Literal('l'), Literal('e'), Literal('.'), ZeroOrMore]) }
2025-02-15T11:17:28.084 globset [DEBUG] built glob set; 1 literals, 0 basenames, 0 extensions, 0 prefixes, 145 suffixes, 11 required extensions, 10 regexes
2025-02-15T11:17:28.096 helix_vcs [DEBUG] Error {
    context: "failed to open git repo",
    source: Discover(
        NoGitRepository {
            path: "~/CAD/Ankarsrum Pasta Maker Adapter",
        },
    ),
}
2025-02-15T11:17:28.096 helix_vcs [DEBUG] failed to open diff base for ~/CAD/Ankarsrum Pasta Maker Adapter/Ankarsrum Pasta Maker Adapter.20241103-174325.FCBak
2025-02-15T11:17:28.096 helix_vcs [DEBUG] Error {
    context: "failed to open git repo",
    source: Discover(
        NoGitRepository {
            path: "~/CAD/Ankarsrum Pasta Maker Adapter",
        },
    ),
}
2025-02-15T11:17:28.096 helix_vcs [DEBUG] failed to obtain current head name for ~/CAD/Ankarsrum Pasta Maker Adapter/Ankarsrum Pasta Maker Adapter.20241103-174325.FCBak
2025-02-15T11:17:28.096 helix_view::editor [DEBUG] editor status: Loaded 1 file.
2025-02-15T11:17:28.096 helix_tui::backend::crossterm [DEBUG] The keyboard enhancement protocol is not supported in this terminal (checked in 237.954µs)
2025-02-15T11:17:28.099 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2025-02-15T11:17:28.102 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2025-02-15T11:17:28.344 helix_term::application [DEBUG] received editor event: IdleTimer
2025-02-15T11:17:28.481 helix_term::application [DEBUG] received editor event: Redraw
2025-02-15T11:17:28.488 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2025-02-15T11:17:29.459 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2025-02-15T11:17:29.705 helix_term::application [DEBUG] received editor event: IdleTimer
2025-02-15T11:17:29.761 helix_term::commands::typed [DEBUG] quitting...
2025-02-15T11:17:29.768 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2025-02-15T11:17:29.882 helix_term::commands::typed [DEBUG] quitting...
2025-02-15T11:17:29.882 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2025-02-15T11:17:29.882 helix_term::job [DEBUG] waiting on jobs...
2025-02-15T11:17:29.882 helix_term::job [DEBUG] waiting on jobs...

Platform

Fedora 41

Terminal Emulator

xfce4-terminal v1.1.4

Installation Method

dnf

Helix Version

helix 25.01.1 (e7ac2fc)

@adam-jw-casey adam-jw-casey added the C-bug Category: This is a bug label Feb 15, 2025
@adam-jw-casey
Copy link
Author

Here is a file that reproduces the bug. It's the first line of an FCBak file, renamed to .txt because otherwise Github won't let me upload it.

binary_file.txt

@adam-jw-casey
Copy link
Author

I checked and the issue does not occur in a buffer filled with random but valid Unicode.

@kirawi
Copy link
Member

kirawi commented Feb 15, 2025

I suspect it contains sequences that are parsed as ansi control codes.

@adam-jw-casey
Copy link
Author

I suspect it contains sequences that are parsed as ansi control codes.

That's likely. I do still think helix should handle it more gracefully though, like neovim does.

@kirawi
Copy link
Member

kirawi commented Feb 16, 2025

I'll check the file later, but it would be a duplicate of #12134 if so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug
Projects
None yet
Development

No branches or pull requests

2 participants