Skip to content

Quote and task list the whole line when nothing is selected - #118

Open
Shriraj1901 wants to merge 1 commit into
github:mainfrom
Shriraj1901:fix-quote-whole-line
Open

Shriraj1901 wants to merge 1 commit into
github:mainfrom
Shriraj1901:fix-quote-whole-line

Conversation

@Shriraj1901

Copy link
Copy Markdown

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.

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.
@Shriraj1901
Shriraj1901 requested a review from a team as a code owner November 26, 2026 03:36
Copilot AI adaptive review requested due to automatic review settings November 26, 2026 03:36

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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 wordSelectionStart and 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

No deployments
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.

2 participants