Skip to content

Conversation

@sminez
Copy link
Owner

@sminez sminez commented Jun 1, 2025

Issue #123 has the full details of the problem (thank you @luka-hash for the report).

The fix here is simply to make use of a Buffer for tracking the input and cursor position in the minibuffer rather than a String and custom logic for handling the input focus. I think this is simply an artefact of the minibuffer being implemented early on in the development of the project and then never being updated to use the logic for handling input that is used by the rest of the editor.

Fixes #123

@sminez
Copy link
Owner Author

sminez commented Jun 1, 2025

Hmmm...looks like nightly has some changes around the lint that prevents use of unicode control code points that alter text direction? That's not part of this change but it looks like I need to lift that allow up to the crate level which isn't great as I only want to allow it for that test.

 error: unicode codepoint changing visible direction of text present in literal
   --> src/ui/tui.rs:954:36
    |
954 |         let line = GapBuffer::from("�foo�bar�baz�");
    |                                    ^-^^^-^^^-^^^-^
    |                                    ||   |   |   |
    |                                    ||   |   |   '\u{2069}'
    |                                    ||   |   '\u{2069}'
    |                                    ||   '\u{2066}'
    |                                    |'\u{2067}'
    |                                    this literal contains invisible unicode text flow control codepoints
    |
    = note: these kind of unicode codepoints change the way text flows on applications that support them, but can cause confusion because they change the order of characters on the screen
    = note: `#[deny(text_direction_codepoint_in_literal)]` on by default
    = help: if their presence wasn't intentional, you can remove them
help: if you want to keep them but make them visible in your source code, you can escape them
    |
954 -         let line = GapBuffer::from("�foo�bar�baz�");
954 +         let line = GapBuffer::from("\u{2067}foo\u{2066}bar\u{2069}baz\u{2069}");
    |

warning: allow(text_direction_codepoint_in_literal) is ignored unless specified at crate level
   --> src/ui/tui.rs:953:17
    |
953 |         #[allow(text_direction_codepoint_in_literal)]
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: `#[warn(unused_attributes)]` on by default

The relevant changes in the compiler are here with the issue that led to those changes being rust-lang/rust#140281. Looks like this is needed to prevent an internal compiler error and that they're aware that this removes the ability to use the lint like this (which they call out as not being great but better than ICE).

@sminez sminez merged commit d449488 into develop Jun 1, 2025
8 checks passed
@sminez sminez deleted the issue-123 branch June 1, 2025 21:39
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

Successfully merging this pull request may close these issues.

In-buffer search in a buffer containing multi-byte UTF-8 characters triggers a panic

2 participants