Skip to content

Commit e08cf30

Browse files
committed
Removed custom caret placement
1 parent 80e86f6 commit e08cf30

File tree

2 files changed

+1
-18
lines changed

2 files changed

+1
-18
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
- Allow showing testcase details on compiler error status
2323
- Enhanced integrated view to display compilation output and errors
2424
- Made the bubble texts in the UI more compact
25+
- Removed custom caret placing from the textarea because it acts inconsistently with the custom truncated display of IO texts
2526

2627
### Fixed
2728

src/webview/AutoresizeTextarea.svelte

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
let containerElement: HTMLDivElement | undefined = $state();
4141
let actionButtonsElement: HTMLDivElement | undefined = $state();
4242
let isHovered = $state();
43-
let initialCursorPosition = $state(0);
4443
let cursorOverlapsActions = $state(false);
4544
let showExpandButton = $state(false);
4645
let showEditButtons = $state(false);
@@ -173,21 +172,6 @@
173172
174173
function handleTextareaTransition(event?: MouseEvent) {
175174
if (!readonly) {
176-
if (event instanceof MouseEvent && value) {
177-
// caretPositionFromPoint is a VERY new function (December 2025!) so fallback to VSCode's
178-
// older caretRangeFromPoint (which is deprecated but still widely supported)
179-
if (typeof (document as any).caretPositionFromPoint === "function") {
180-
const position = (document as any).caretPositionFromPoint(event.clientX, event.clientY);
181-
initialCursorPosition = position?.offset ?? value.length;
182-
} else if (typeof document.caretRangeFromPoint === "function") {
183-
const range = document.caretRangeFromPoint(event.clientX, event.clientY);
184-
initialCursorPosition = range?.startOffset ?? value.length;
185-
} else {
186-
initialCursorPosition = value.length;
187-
}
188-
} else {
189-
initialCursorPosition = value?.length ?? 0;
190-
}
191175
editing = true;
192176
onpreedit?.();
193177
}
@@ -196,8 +180,6 @@
196180
$effect(() => {
197181
if (editing && textarea && document.activeElement !== textarea) {
198182
textarea.focus();
199-
const pos = Math.min(initialCursorPosition, value?.length ?? 0);
200-
textarea.setSelectionRange(pos, pos);
201183
}
202184
});
203185

0 commit comments

Comments
 (0)