Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

💡 Signed margin: offset a box without consuming content width

Aperta
#65 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
55/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Tranquilla
Stack tecnologico
c, typescript
Ambito
cli

Direzione di ricerca

Inizia da test/signed-margin.test.ts e dal diff di riproduzione, poi leggi il packing del padding in ops.ts e il decoding del layout intorno a src/clayterm.c:499. Traccia come Clay_LayoutConfig e il clip path esistente gestiscono la geometria del box. È completato quando i margin con segno positivi e negativi preservano la larghezza del contenuto, spostano il box, ritagliano l'overflow iniziale e superano il test signed-margin.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

enhancement

Is your feature request related to a problem?

There's no way to offset a box's position within its parent's flow. The only per-side knob is layout.padding, which shrinks the content box instead of moving the box: "Hello W" (7 cells) fits on one line in a fixed(8) box, but padding: { left: 2 } drops content to 6 cells and wraps to two lines. Padding also can't be negative—each side is an unsigned byte, so padding: { left: -3 } wraps to garbage (the box returns height: 511). There's no primitive for placing a box before its parent's content origin and clipping the overflow.

Describe the solution you'd like

A signed layout.margin that moves a box without shrinking its content, mirroring the CSS margin property: it sits outside the content box and may be negative. margin: { left: 2 } keeps the box's width and stays on one line; a negative left margin places the origin before the parent's content origin, so with the parent clipping, the leading cells are suppressed and the rest renders flush to the edge.

open("box", {
  layout: { width: fixed(12), margin: { left: -3 } },
});

Describe alternatives you've considered

padding as a stand-in fails both ways: it shrinks content and corrupts geometry on negative input (unsigned packing). Pre-clipping strings in JS can't reflow or re-clip on resize and doesn't generalize to nested boxes.

Additional context

Failing test case on nm/repro/signed-margin (test · diff). margin needs its own signed word (the ops.ts padding packing is 4×uint8 and can't be reused) and a post-layout offset step in the layout decode (src/clayterm.c:499); Clay_LayoutConfig has no margin, so it's a new primitive on top of Clay that leans on the existing clip path.

Lingua principale
TypeScript
Stelle
42
Fork
2
Merge medio
2g 5h
PR unite (30g)
12

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di bombshell-dev/tty

Tutte le issue di bombshell-dev/tty

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.