reedline: Cannot type curly brackets in engine-q

After building and running engine-q, I cannot type { or }. I use an italian keyboard, where opening and closing curly brackets implies pressing: Shift + Alt Gr + Key.

Note that even just typing [ or ] seems to present a problem, and it implies pressing: Alt Gr + Key. In this case, the square brackets are printed, but they can only be cancelled by pressing Backspace twice; it looks like “two characters were pushed” instead of one.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 25 (25 by maintainers)

Commits related to this issue

Most upvoted comments

OK after discussing with @aslynatilla the remaining invisible character issue seems to be stemming from VS codes internal terminal and key detection. No need to file with crossterm

I won’t probably be able to do it tonight, but… it’s definitely something I can do in the next days! Should I quote this issue?

@aslynatilla I would vote for closing the issue here as your fixed the direct input problem with your PR. Would you mind describing the issue of the invisible character to delete on crossterm’s bugtracker with info regarding platform, terminal emulator etc.?

Tried a run with cargo run -- -k and… it doesn’t look like there are different unicode scalar values. Specifically:

Char: { code: 0x00007b; Modifier SHIFT | CONTROL | ALT; Flags 0b000111
Char: } code: 0x00007d; Modifier SHIFT | CONTROL | ALT; Flags 0b000111
Char: [ code: 0x00005b; Modifier CONTROL | ALT; Flags 0b000110
Char: ] code: 0x00005d; Modifier CONTROL | ALT; Flags 0b000110

It apparently makes sense. The same considerations from above are still valid. You need to press Backspace twice to delete a bracket, if it is the last printed character; it “goes back to normal” if you typed something after that - you can delete both the following character and the bracket by pressing Backspace twice.

OK either we deal with an invisible character/unicode scalar on the reedline side or there is a bug on the crossterm side. You could give the new main cargo run -- -k another go if we have different unicode scalar values. Other than that I was dabbling with JT on a change to how we pull the events from crossterm to drain all events between refreshs but this should only affect timing of events/display stuff but not how the internal string looks like. When I get that finished we might instrument that again and probably have to open the issue with crossterm

@aslynatilla forgot to mention, could you add the same case for the vim event file?

There is a brace matching logic that will continue to a new line if the brace is not closed included with the demo binary.

so

> {<Cursor><Enter>

should result in

> {
<Cursor>

but after

> {
}<Cursor><Enter>

the program should exit.

Implementation: https://github.com/nushell/reedline/blob/e159f3fd0d3bbb69c263f9925206977ab77834a4/src/validator.rs#L21