From a8dff2d86e92c703ae58dc283ce16889c8792f45 Mon Sep 17 00:00:00 2001 From: cpacker Date: Sat, 25 Oct 2025 14:30:14 -0700 Subject: [PATCH] fix: patch cursor overflow --- vendor/ink-text-input/build/index.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/vendor/ink-text-input/build/index.js b/vendor/ink-text-input/build/index.js index 9023ef9..05197c9 100644 --- a/vendor/ink-text-input/build/index.js +++ b/vendor/ink-text-input/build/index.js @@ -93,12 +93,7 @@ function TextInput({ value: originalValue, placeholder = '', focus = true, mask, nextCursorWidth = input.length; } } - if (cursorOffset < 0) { - nextCursorOffset = 0; - } - if (cursorOffset > originalValue.length) { - nextCursorOffset = originalValue.length; - } + nextCursorOffset = Math.max(0, Math.min(nextCursorOffset, nextValue.length)); setState({ cursorOffset: nextCursorOffset, cursorWidth: nextCursorWidth }); if (typeof onCursorOffsetChange === 'function') onCursorOffsetChange(nextCursorOffset); if (nextValue !== originalValue) { @@ -112,4 +107,3 @@ export function UncontrolledTextInput({ initialValue = '', ...props }) { const [value, setValue] = useState(initialValue); return React.createElement(TextInput, { ...props, value: value, onChange: setValue }); } -