Skip to content

feat(editor): indent list items with Tab and outdent with Shift+Tab (#210) - #215

Merged
gnacho merged 1 commit into
masterfrom
feat/210-list-indent
Nov 21, 2026
Merged

gnacho merged 1 commit into
masterfrom
feat/210-list-indent

Conversation

@gnacho

@gnacho gnacho commented Nov 21, 2026

Copy link
Copy Markdown
Owner

Closes #210

What

Tab used to insert spaces after the list marker, so the text of the item moved right but the item stayed at the same level, and there was no keyboard way to outdent. Now Tab adds one level (four spaces) in front of the line when the line is a list item, and Shift+Tab removes one level (four spaces or a tab).

Both keys use the same key handler and the same detection that Enter uses to continue a list, and they respect the 'continue lists' preference. A line that is not a list item is left to the text view, so text editing and keyboard navigation are unchanged.

Tests

  • Unit: tab_indenta_un_elemento_de_lista, shift_tab_desindenta_un_elemento_de_lista, tab_no_toca_lo_que_no_es_lista.
  • Buffer: tests/list_indent.rs with a real GtkSourceView, cursor position included, two levels and the outdent from four spaces and from a tab (runs under xvfb-run).
  • End to end in the real app under Xvfb: * algo + Enter + Tab + mas + Enter + Tab + mas2 saves * algo, four spaces * mas, eight spaces * mas2.

make check green.

…210)

Tab used to insert spaces after the marker, so the item text moved right but the item stayed at the same level, and there was no way to outdent from the keyboard.

Tab now adds one level (four spaces) in front of the line when it is a list item, and Shift+Tab removes one level (four spaces or a tab). Both are gated by the same 'continue lists' preference that already drives Enter, and a line that is not a list item is left to the text view, so text editing and keyboard navigation do not change.

The buffer test covers the cursor position and the two-level case. Measured end to end in the real app under Xvfb: '* algo' + Enter + Tab + 'mas' + Enter + Tab + 'mas2' saves '* algo / four spaces * mas / eight spaces * mas2'.
@gnacho
gnacho merged commit 780665d into master Nov 21, 2026
3 checks passed
@gnacho
gnacho deleted the feat/210-list-indent branch November 21, 2026 21:16
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.

Improve list indentation

1 participant