Skip to content

fix(editor): stop reading a lone dash as a setext heading - #201

Merged
gnacho merged 1 commit into
masterfrom
fix/200-lone-dash-setext
Nov 18, 2026
Merged

gnacho merged 1 commit into
masterfrom
fix/200-lone-dash-setext

Conversation

@gnacho

@gnacho gnacho commented Nov 18, 2026

Copy link
Copy Markdown
Owner

Typing - at the start of a line right after a sentence turned that sentence into a heading and kept the dash hidden until a letter was typed. A lone - or = is plain text now.

Three changes:

  • analyze() ignores a setext underline of one character. A -- or longer still works as a heading, and a - after a blank line is still an empty list item.
  • The setext underline is revealed when the cursor is on its line. Its hidden span starts at the newline of the previous line, so the cursor line check never matched and the underline could not be seen or edited.
  • The preview panel follows the same rule so both panes agree.

Tests: un_guion_suelto_no_convierte_el_parrafo_en_cabecera, un_igual_suelto_no_convierte_el_parrafo_en_cabecera, un_subrayado_largo_sigue_siendo_cabecera, un_guion_tras_linea_en_blanco_sigue_siendo_item_vacio, the two preview tests and tests/setext_reveal.rs.

Closes #200

@gnacho
gnacho merged commit 62c7347 into master Nov 18, 2026
3 checks passed
@gnacho
gnacho deleted the fix/200-lone-dash-setext branch November 18, 2026 13:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Typing a lone dash after a paragraph turns it into a heading

1 participant