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

Panic con gf with accented characters #13254

Open
JulianGCalderon opened this issue Apr 2, 2025 · 2 comments
Open

Panic con gf with accented characters #13254

JulianGCalderon opened this issue Apr 2, 2025 · 2 comments
Labels
C-bug Category: This is a bug

Comments

@JulianGCalderon
Copy link

Summary

When using gf on a document with accented characters, panics if the cursor is near the end of a document.

Reproduction Steps

I tried this:

  1. printf '\xc3\xa1' | hx
  2. pressed gf

I expected this to happen:

It should not panic

Instead, this happened:

thread 'main' panicked at /Users/brew/Library/Caches/Homebrew/cargo_cache/registry/src/index.crates.io-6f17d22bba15001f/ropey-1.6.1/src/rope.rs:952:36:
called `Option::unwrap()` on a `None` value
stack backtrace:
   0: _rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::panicking::panic
   3: core::option::unwrap_failed
   4: helix_term::commands::goto_file_impl
   5: helix_term::ui::editor::EditorView::handle_keymap_event::{{closure}}
   6: helix_term::ui::editor::EditorView::handle_keymap_event
   7: <helix_term::ui::editor::EditorView as helix_term::compositor::Component>::handle_event
   8: helix_term::compositor::Compositor::handle_event
   9: hx::main_impl::{{closure}}
  10: tokio::runtime::park::CachedParkThread::block_on
  11: tokio::runtime::context::runtime::enter_runtime
  12: tokio::runtime::runtime::Runtime::block_on
  13: hx::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Helix log

~/.cache/helix/helix.log
2025-04-02T17:28:52.942 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-04-02T17:28:52.942 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-04-02T17:28:52.942 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-04-02T17:28:52.942 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-04-02T17:28:52.942 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-04-02T17:28:52.942 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-04-02T17:28:52.942 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-04-02T17:28:52.942 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-04-02T17:28:52.942 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-04-02T17:28:52.942 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-04-02T17:28:52.942 globset [DEBUG] built glob set; 1 literals, 0 basenames, 0 extensions, 0 prefixes, 145 suffixes, 11 required extensions, 10 regexes
2025-04-02T17:28:52.947 helix_tui::backend::crossterm [DEBUG] The keyboard enhancement protocol is supported in this terminal (checked in 162.292µs)
2025-04-02T17:28:52.947 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 1
2025-04-02T17:28:52.948 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 1
2025-04-02T17:28:53.197 helix_term::application [DEBUG] received editor event: IdleTimer
2025-04-02T17:28:53.334 helix_term::application [DEBUG] received editor event: Redraw
2025-04-02T17:28:53.334 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 1
2025-04-02T17:28:54.242 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 1

Platform

macOS

Terminal Emulator

Kitty

Installation Method

brew

Helix Version

helix 25.01.1 (e7ac2fc)

@JulianGCalderon JulianGCalderon added the C-bug Category: This is a bug label Apr 2, 2025
@ArchKZ
Copy link

ArchKZ commented Apr 3, 2025

Can confirm this bug on arch linux for 25.01.1 as well. In a document containing only the character "á", using "gf" crashes with

thread 'main' panicked at /build/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ropey-1.6.1/src/rope.rs:952:36:
called `Option::unwrap()` on a `None` value

@lmerz1
Copy link

lmerz1 commented Apr 4, 2025

For what it's worth, on my slightly-outdated from-source build, I cannot reproduce with the otherwise same environment as in the original report (Darwin, kitty), so this might've been fixed somewhere in between the latest release and my build (helix 25.01.1 (13b2dc3)).

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

3 participants