#16320·helix

C0 control characters are given width 1 but written raw, so the cursor and repaints drift one column per control character

Author: serglukaCreated Sep 28, 2026Updated Sep 28, 2026

Summary

A line containing a C0 control character (e.g. \x01) desynchronises Helix's screen column from the terminal's.

grapheme_width gives every ASCII byte width 1, control characters included, and that is deliberate:

https://github.com/helix-editor/helix/blob/master/helix-core/src/graphemes.rs#L97-L111

rust
if g.as_bytes()[0] <= 127 {
    // Point 1: theoretically, ascii control characters should have zero
    // width, but in our case we actually want them to have width: if they
    // show up in text, we want to treat them as textual elements that can
    // be edited. ...
    1
}

Treating them as one cell wide is reasonable for editing, but the cell is then written to the terminal as the raw byte, and the terminal advances zero columns for it. From that point on, every column Helix computes for the rest of the line is one too far right per preceding control character.

Because the first paint of a line is emitted sequentially, it still reads correctly — the text just slides left and the control characters look invisible. The damage appears on any partial repaint that positions the cursor by column: moving the cursor is enough. The cursor separates from the character it is on, and repainted cells overwrite their neighbours, duplicating and swallowing characters.

This makes Helix unusable for log formats that use a control byte as a field separator — FIX protocol logs (\x01) being the common case. Anything that repaints parts of those lines (inlay hints, diagnostics) compounds it, and once a line is corrupted it stays corrupted until a full repaint.

Reproduction Steps

I tried this:

  1. printf 'aaa\001bbb\001ccc\001ddd\n' > /tmp/control.txt
  2. hx /tmp/control.txt
  3. Press l twelve times.

I expected this to happen:

The line reads aaabbbcccddd (the SOH bytes print nothing), and after twelve l the cursor sits on the first d — the tenth printable cell.

Instead, this happened:

The line becomes aaabbbbccccd — the cursor's repaint duplicates a b and a c and eats the tail — and the cursor is drawn three cells to the right of the d it is on. Three is exactly the number of \x01 bytes the cursor has passed; the drift grows by one per control character.

For contrast, the same file with a printable separator behaves perfectly, which isolates the control byte as the only variable:

bash
printf 'aaa|bbb|ccc|ddd\n' > /tmp/pipe.txt
hx /tmp/pipe.txt

Reproduced in both kitty and tmux, so it is not specific to one terminal.

Related: #11255 asks for unprintable characters to be substituted with a placeholder. That would fix this as a side effect — the width-1 decision above is only sound if such a cell is also drawn one column wide. #6012 is the same class of grapheme-width/terminal-grid mismatch, but scoped to wide and emoji graphemes.

Helix log

~/.cache/helix/helix.log
Nothing is logged for this; it is a rendering issue, reproducible with no language server attached.

Platform

Linux (Fedora 44)

Terminal Emulator

kitty 0.47.4 (also reproduced under tmux 3.5a)

Installation Method

Fedora package (helix-25.07.1-11.fc44.x86_64)

Helix Version

helix 25.07.1 (a05c151b)