Legacy vs Full Unicode support

Unicode Rendering Modes in AbsoluteTelnet/SSH

LEGACY vs FULL and DEC Private Mode 2027

AbsoluteTelnet/SSH includes two Unicode rendering modes: LEGACY and FULL. These modes control how text is interpreted and displayed—particularly how character width, cursor movement, and selection boundaries are handled.

Host applications can switch between these modes using DEC Private Mode 2027, allowing precise control over how the terminal behaves.

AbsoluteTelnet/SSH version 13.16 introduces the FULL mode and support for DEC Private mode 2027 to switch between LEGACY and FULL. Versions prior to 13.16 operate in LEGACY mode only.


LEGACY Rendering Mode

Goal: Preserve traditional terminal behavior and compatibility.

In LEGACY mode:

  • Text is interpreted using a cell-based model
  • Each character maps to 1 or 2 columns (via wcwidth()-style logic)
  • Cursor movement and layout are strictly column-driven
  • Selection follows the underlying grid, even if it splits Unicode sequences
  • Based on the traditional wcwidth() model (Markus Kuhn, later extended by Thomas Dickey)
  • Works well for most single-character scripts (Latin, Hebrew, Cyrillic), simple combining characters, and East Asian double-width characters

This mode is designed for:

  • Classic terminal applications
  • Programs that depend on fixed-width assumptions
  • Environments where layout predictability is critical
  • Good for: legacy vi, vim, and similar applications that depend on traditional width behavior

FULL Rendering Mode

Goal: Provide correct handling of modern Unicode text.

In FULL mode:

  • Text is interpreted as grapheme clusters, not individual code points
  • Multi-codepoint sequences are treated as a single unit, including:
    • Combining characters (e.g., a̱)
    • Emoji with modifiers (e.g., 👨🏿)
    • ZWJ sequences (e.g., 👨‍👩‍👧‍👦)
    • Forward joining characters
    • Variation selectors (VS15, VS16)
    • Regional indicators
    • Spacing combining characters
    • Flags and tags
    • Complex scripts and viramas
  • Cursor movement and selection respect cluster boundaries
  • Copy/paste preserves valid, complete Unicode text
  • Compatible with Jeff Quast’s updated wcwidth work and validated using his ucs-detect tool

This mode is intended for:

  • Modern CLI tools
  • Unicode-rich output
  • Situations where text correctness matters more than strict column behavior
  • Good for: Neovim and other applications that expect advanced clustering and width behavior

Switching Modes with DEC Private Mode 2027

DEC Private Mode 2027 allows the host to control which rendering model is active:

  • Enable FULL rendering mode:
ESC [ ? 2027 h
  • Enable LEGACY rendering mode:
ESC [ ? 2027 l

This gives applications the flexibility to:

  • Use LEGACY when relying on traditional terminal layout
  • Switch to FULL when emitting complex Unicode text

Why This Matters

Terminal emulation has historically been cell-based, while modern text is grapheme-based. Without a way to choose between these models, terminals must compromise—leading to issues like:

  • Split emoji or combining sequences during selection
  • Misaligned cursor movement
  • Invalid copy/paste output

By separating rendering into two explicit modes, AbsoluteTelnet/SSH avoids those compromises.


Summary

ModeModelBest For
LEGACYCell-basedTraditional terminal apps
FULLGrapheme-basedModern Unicode text

DEC Private Mode 2027 is the mechanism that selects between these modes—allowing host applications to opt into the level of Unicode support they require.

Leave a Comment

Your email address will not be published. Required fields are marked *