Repository navigation
feat(editor): indent list items with Tab and outdent with Shift+Tab (#210) - #215
Merged
Merged
Conversation
…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'.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
tab_indenta_un_elemento_de_lista,shift_tab_desindenta_un_elemento_de_lista,tab_no_toca_lo_que_no_es_lista.tests/list_indent.rswith a real GtkSourceView, cursor position included, two levels and the outdent from four spaces and from a tab (runs underxvfb-run).* algo+ Enter + Tab +mas+ Enter + Tab +mas2saves* algo, four spaces* mas, eight spaces* mas2.make checkgreen.