Repository navigation
Quote and task list the whole line when nothing is selected - #118
Open
Shriraj1901 wants to merge 1 commit into
Open
Shriraj1901 wants to merge 1 commit into
Shriraj1901 wants to merge 1 commit into
Conversation
With an empty selection the quote and task list buttons are meant to act on the whole line. wordSelectionEnd already stops at a newline instead of whitespace when `multiline` is set, but wordSelectionStart was never given the same treatment, so it still stopped at the previous space. Clicking Quote with the cursor in the middle of a line therefore split the line: The quick brown| fox -> "The quick \n\n> brown| fox" and with the cursor at the end of a line only the last word was quoted. At the very end of the text the start was not expanded at all, so the button added an empty quote below the line instead of quoting it. Pass `multiline` to wordSelectionStart so the selection starts at the beginning of the line, including when the cursor is at the end of the text. Styles that are not multiline behave as before.
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are identified, and the changes include regression coverage for multiline quote and task-list behavior across cursor positions and line boundaries.
No open issues 🎉
What changed in this PR
Updates multiline text expansion so quote and task-list actions apply to the entire current line when the selection is empty, including when the cursor is at the end of the text.
Changes:
- Passes the multiline flag to
wordSelectionStartand stops backward scanning at newline boundaries. - Preserves word-based selection behavior for non-multiline styles.
- Adds regression coverage for quote and task-list behavior across cursor positions and line boundaries.
| File | Description |
|---|---|
| test/test.js | Adds regression tests for full-line quote and task-list operations across cursor positions and line boundaries. |
| src/index.ts | Expands empty multiline selections backward to the beginning of the current line, including from end-of-text positions. |
Review effort: Lite (adaptive)
This branch has not been deployed
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.
With an empty selection the quote and task list buttons are meant to act on the whole line. wordSelectionEnd already stops at a newline instead of whitespace when
multilineis set, but wordSelectionStart was never given the same treatment, so it still stopped at the previous space. Clicking Quote with the cursor in the middle of a line therefore split the line:The quick brown| fox -> "The quick \n\n> brown| fox"
and with the cursor at the end of a line only the last word was quoted. At the very end of the text the start was not expanded at all, so the button added an empty quote below the line instead of quoting it.
Pass
multilineto wordSelectionStart so the selection starts at the beginning of the line, including when the cursor is at the end of the text. Styles that are not multiline behave as before.