Skip to content

Commit 703625d

Browse files
fix: faster paste speed (#824)
* fix: update delay handling in PasteModal component - Changed default delay value to 20 and adjusted validation to allow values between 0 and 65534. - Cleaned up code formatting for better readability. * fix: formatting
1 parent cb24ef6 commit 703625d

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

ui/src/components/popovers/PasteModal.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import { TextAreaWithLabel } from "@components/TextArea";
1717

1818
// uint32 max value / 4
1919
const pasteMaxLength = 1073741824;
20+
const defaultDelay = 20;
2021

2122
export default function PasteModal() {
2223
const TextAreaRef = useRef<HTMLTextAreaElement>(null);
@@ -27,10 +28,10 @@ export default function PasteModal() {
2728
const { executeMacro, cancelExecuteMacro } = useKeyboard();
2829

2930
const [invalidChars, setInvalidChars] = useState<string[]>([]);
30-
const [delayValue, setDelayValue] = useState(100);
31+
const [delayValue, setDelayValue] = useState(defaultDelay);
3132
const delay = useMemo(() => {
32-
if (delayValue < 50 || delayValue > 65534) {
33-
return 100;
33+
if (delayValue < 0 || delayValue > 65534) {
34+
return defaultDelay;
3435
}
3536
return delayValue;
3637
}, [delayValue]);
@@ -40,7 +41,7 @@ export default function PasteModal() {
4041
const delayClassName = useMemo(() => debugMode ? "" : "hidden", [debugMode]);
4142

4243
const { setKeyboardLayout } = useSettingsStore();
43-
const { selectedKeyboard } = useKeyboardLayout();
44+
const { selectedKeyboard } = useKeyboardLayout();
4445

4546
useEffect(() => {
4647
send("getKeyboardLayout", {}, (resp: JsonRpcResponse) => {
@@ -136,7 +137,8 @@ export default function PasteModal() {
136137
<div
137138
className="w-full"
138139
onKeyUp={e => e.stopPropagation()}
139-
onKeyDown={e => e.stopPropagation()} onKeyDownCapture={e => e.stopPropagation()}
140+
onKeyDown={e => e.stopPropagation()}
141+
onKeyDownCapture={e => e.stopPropagation()}
140142
onKeyUpCapture={e => e.stopPropagation()}
141143
>
142144
<TextAreaWithLabel

0 commit comments

Comments
 (0)