Fix InsertTextAtCursor not using TrueSelection and thus breaking on inverse selection.#4
Conversation
…ng from end to start)
WalkthroughInsertTextAtCursor now computes replacement boundaries using TrueSelectionStartWithoutLineBreaks and TrueSelectionEndWithoutLineBreaks when a selection exists, ensuring correct start/end positions regardless of selection direction. No other logic in the method changed. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant U as User
participant E as EditableTextBase
participant S as Selection State
participant D as Document Buffer
U->>E: InsertTextAtCursor(text)
E->>S: Check selection range
alt Selection exists
S-->>E: TrueSelectionStart/End (no line breaks)
note over E: Use TrueSelection* to compute replacement
E->>D: Replace [start:end] with text
else No selection
E->>D: Insert text at caret position
end
E->>S: Update caret and selection
E-->>U: Return
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🔇 Additional comments (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary by CodeRabbit