Skip to content

Non-BMP characters (emoji, some symbols) typed or pasted on Windows produce no event. BMP input works fine. #40

Closed

Description

@NeonMedusa

KEY_EVENT_RECORD.UnicodeChar is a UTF-16 code unit, so an emoji arrives as two consecutive KEY_EVENTs (leading + trailing surrogate). The guard in windows.zig:

if (unicode_char > 0 and unicode_char < 0xD800) { ... }

rejects both halves, so the character is lost. conhost pairs surrogates it self before handing records to the app; a library reading raw KEY_EVENTs has to do the same (Microsoft's _leadingSurrogate in terminalInput.cpp).

Ran into this while building a TUI on zigtui — the emoji picker (Win+.) and pasting an emoji into the input field both produce nothing. crossterm hit the same thing: crossterm-rs/crossterm#1072

I'm preparing a PR for this, will send it shortly.

Activity

  1. NeonMedusa commented on Sep 20, 2026

    @NeonMedusa
    ContributorAuthor

    After fixing this I found another, separate bug: TextInput stores wide characters (CJK, emoji) correctly but renders them as blanks - the field is empty while the Buffer line below shows the full text.

    Image

    render() advances one column per code point, so the next glyph is written into the trailing cell of a wide character and the cell buffer clears the pair. Counting display columns via codepointWidth fixes it.

    Now part of #42 along with the input fix.

  2. added a commit that references this issue on Sep 21, 2026
    598464c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions