micro-editor / micro-editor/micro

Unicode escape characters not recognized

Open
#2,087 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
29.6k
Forks
1.4k
Avg merge
2d 18h
Merged PRs (30d)
10

Description

For example, in my custom keymapping (to be loaded with loadkeys), I map ctrl shift k to ctrl shift k:

control keycode 37 = F232
string F232 = "\033[107;6u"

The syntax is nicely explained here if necessary.
Vim understands this keycode, but micro raw doesn't and instead prints

EventKey: Alt-[: "\x1b["
EventKey: 1: "1"
EventKey: 0: "0"
EventKey: 7: "7"
EventKey: ;: ";"
EventKey: 6: "6"

Contrary example with Ctrl-Leftarrow:

control shift keycode 105 = F200
string F200 = "\033[1;6D"

micro raw correctly says EventKey: Ctrl-Shift-Left: "\x1b[1;6D".

Specifications:
Version: 2.0.8
Commit hash: cfcb2e45
Terminal: TTY Linux console. That's why I am using a custom keymapping. But I also reproduced this behavior with Xterm: In the above linked stackexchange answer, you can find the steps on how to do that. It's the same issue here: sending left works, sending k does not.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the mappings in micro raw on the Linux console or Xterm, comparing the F232 sequence with the working F200 sequence. Trace how micro parses the escape sequence and recognize the Unicode-style key event so the input is reported as Ctrl-Shift-K rather than individual characters.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.