Skip to main content

Module qr

Module qr 

Source
Expand description

Render a URL as a terminal-friendly QR code for the OAuth login flow (/login, /codingplan).

Two styles, both Unicode:

  • Dense1x2 (default): 1×2 modules per char using ▀▄█. ≈ 45 cols × 23 rows. Block elements (U+2580–U+259F) are Unicode-Neutral width, so no terminal renders them at double width. QR aspect stays 1:1 and scanners decode reliably under any configuration.
  • Braille (opt-in): packs 2×4 modules into one U+2800–U+28FF char. ≈ 23 cols × 12 rows — about half the size. But Braille is Unicode-Ambiguous width and gets stretched 2× horizontally on terminals that default ambiguous-width to double (iTerm2’s “Treat ambiguous-width characters as double width”, on by default in many profiles). Use only when you know your terminal renders braille at single cell width.

There is no ASCII rendering: at typical 1:2 monospace cell ratios, an ASCII QR with module_dimensions(2, 1) exceeds 90 columns for any usable URL — wider than every realistic terminal window. Callers (compose_login_chrome) must short-circuit to URL-only output when TerminalCaps::unicode_symbols is false.

Enums§

QrStyle

Functions§

block_cols
Visible column count of the widest line in rendered. Both styles emit exactly one terminal cell per char, so chars().count() is the correct cell count.
render_login_qr
Render url as a multi-line QR string. Returns None only when QR encoding itself fails (URL exceeds version 40 capacity ~4 KB — never the case for OAuth URLs in practice).