Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

fix input slash stop working

Louis Beaumont55278bdd4c4d
diff --git a/screenpipe-app-tauri/components/ui/input.tsx b/screenpipe-app-tauri/components/ui/input.tsx
index 677d05fd6..1bad6f42c 100644
--- a/screenpipe-app-tauri/components/ui/input.tsx
+++ b/screenpipe-app-tauri/components/ui/input.tsx
@@ -1,12 +1,23 @@
-import * as React from "react"
-
-import { cn } from "@/lib/utils"
+import * as React from "react";
+import { cn } from "@/lib/utils";
export interface InputProps
extends React.InputHTMLAttributes<HTMLInputElement> {}
const Input = React.forwardRef<HTMLInputElement, InputProps>(
({ className, type, ...props }, ref) => {
+ const handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {
+ if (type === "url" && e.key === "/") {
+ e.preventDefault();
+ const input = e.currentTarget;
+ const start = input.selectionStart || 0;
+ const end = input.selectionEnd || 0;
+ const value = input.value;
+ input.value = value.slice(0, start) + "/" + value.slice(end);
+ input.setSelectionRange(start + 1, start + 1);
+ }
+ };
+
return (
<input
type={type}
@@ -15,11 +26,12 @@ const Input = React.forwardRef<HTMLInputElement, InputProps>(
className
)}
ref={ref}
+ onKeyDown={handleKeyDown}
{...props}
/>
- )
+ );
}
-)
-Input.displayName = "Input"
+);
+Input.displayName = "Input";
-export { Input }
+export { Input };