Fix: Backspace with Select All active merges thoughts instead of deleting them#4008
Fix: Backspace with Select All active merges thoughts instead of deleting them#4008
Conversation
…ect active Agent-Logs-Url: https://github.com/cybersemics/em/sessions/f9a51bb9-5342-4961-b3f8-7eb226ebbb1b Co-authored-by: raineorshine <750276+raineorshine@users.noreply.github.com>
raineorshine
left a comment
There was a problem hiding this comment.
Th new puppeteer test is failing. Do not request a review until puppeteer tests pass.
| - C | ||
| `) | ||
|
|
||
| await clickThought('C') |
There was a problem hiding this comment.
This does not guarantee that the caret moves to the beginning of the thought, which is a requirement in the Steps to Reproduce.
There was a problem hiding this comment.
Fixed in commit 4a6a603. Now using click(editableC, { edge: 'left' }) followed by waitUntil(() => window.getSelection()?.focusOffset === 0) to explicitly place the caret at the beginning of 'C' before calling selectAll, matching the Steps to Reproduce.
…r test Agent-Logs-Url: https://github.com/cybersemics/em/sessions/4e51932c-37f1-4e6b-b5cb-c97b1dd9d434 Co-authored-by: raineorshine <750276+raineorshine@users.noreply.github.com>
raineorshine
left a comment
There was a problem hiding this comment.
Looks good, but the puppeteer test is failing.
…ptyThoughtOrOutdent exec Agent-Logs-Url: https://github.com/cybersemics/em/sessions/7341befb-6ac4-4afa-a4af-ddfc66547bb6 Co-authored-by: raineorshine <750276+raineorshine@users.noreply.github.com>
Fixed in commit 3e99feb. The root cause was that |
When multiple thoughts are selected via Select All (
cmd+opt+a) and the user presses Backspace, all thought text was merged into a single thought instead of the selected thoughts being deleted.Root cause:
deleteEmptyThoughtOrOutdent(bound to plain Backspace) calleddeleteEmptyThoughtunconditionally during multicursor execution.deleteEmptyThoughtmerges a thought with its previous sibling — the wrong behavior when multiple thoughts are selected.Changes
src/commands/deleteEmptyThoughtOrOutdent.tsexec, checkhasMulticursor(state)first and dispatchdeleteThoughtWithCursor()instead ofdeleteEmptyThoughtwhen multiselect is activeclearMulticursor: trueto themulticursorconfig so selection is cleared post-deletiononCompletecallback to show a "Deleted N thoughts." alert, consistent with thedeletecommandsrc/e2e/puppeteer/__tests__/multiselect.ts