@@ -253,6 +253,7 @@ const AIPanelComponentInner = memo(() => {
253253 const isLayoutMode = jotai . useAtomValue ( atoms . controlShiftDelayAtom ) ;
254254 const showOverlayBlockNums = jotai . useAtomValue ( getSettingsKeyAtom ( "app:showoverlayblocknums" ) ) ?? true ;
255255 const isFocused = jotai . useAtomValue ( model . isWaveAIFocusedAtom ) ;
256+ const focusFollowsCursorMode = jotai . useAtomValue ( getSettingsKeyAtom ( "app:focusfollowscursor" ) ) ?? "off" ;
256257 const telemetryEnabled = jotai . useAtomValue ( getSettingsKeyAtom ( "telemetry:enabled" ) ) ?? false ;
257258 const isPanelVisible = jotai . useAtomValue ( model . getPanelVisibleAtom ( ) ) ;
258259 const tabModel = maybeUseTabModel ( ) ;
@@ -509,6 +510,16 @@ const AIPanelComponentInner = memo(() => {
509510 [ model ]
510511 ) ;
511512
513+ const handlePointerEnter = useCallback (
514+ ( event : React . PointerEvent < HTMLDivElement > ) => {
515+ if ( focusFollowsCursorMode !== "on" ) return ;
516+ if ( event . pointerType === "touch" || event . buttons > 0 ) return ;
517+ if ( isFocused ) return ;
518+ model . focusInput ( ) ;
519+ } ,
520+ [ focusFollowsCursorMode , isFocused , model ]
521+ ) ;
522+
512523 const handleClick = ( e : React . MouseEvent ) => {
513524 const target = e . target as HTMLElement ;
514525 const isInteractive = target . closest ( 'button, a, input, textarea, select, [role="button"], [tabindex]' ) ;
@@ -548,6 +559,7 @@ const AIPanelComponentInner = memo(() => {
548559 borderBottomLeftRadius : 10 ,
549560 } }
550561 onFocusCapture = { handleFocusCapture }
562+ onPointerEnter = { handlePointerEnter }
551563 onDragOver = { handleDragOver }
552564 onDragEnter = { handleDragEnter }
553565 onDragLeave = { handleDragLeave }
0 commit comments