Menu

#152 [feature] General mouse use support

open
nobody
2025-11-18
2025-10-05
Anonymous
No

Originally created by: supreme-gg-gg

Is your feature request related to a problem? Please describe.
See discussion in [#150]

Describe the solution you'd like
It is possible to use moues for scrolling, perhaps we can add that for selecting messages as well, just click on the message and it's selected (so you don't need to press k 15 times to go up). There might be more use for this elsewhere in the app

Describe alternatives you've considered
The current keyboard approach is not bad, but as nvim upgrades vim with mouse support, why don't we do the same lol especially with scrolling

Additional context
I think Gemini CLI handles scrolling just by using the terminal's buffer, but we can't do that because we want only the message list to be scrollable!

Related

Tickets: #150
Tickets: #153

Discussion

  • Anonymous

    Anonymous - 2025-11-18

    Originally posted by: supreme-gg-gg

    I have done a quick spike on how Gemini CLI added mouse use, overall they added a Mouse context module to wrap their app:

    const AppWrapper = () => {
        useKittyKeyboardProtocol();
        return (
          <SettingsContext.Provider value={settings}>
            <KeypressProvider
              config={config}
              debugKeystrokeLogging={settings.merged.general?.debugKeystrokeLogging}
            >
              <MouseProvider
                mouseEventsEnabled={mouseEventsEnabled}
                debugKeystrokeLogging={
                  settings.merged.general?.debugKeystrokeLogging
                }
              >
                <ScrollProvider>
                  <SessionStatsProvider>
                    <VimModeProvider settings={settings}>
                      <AppContainer
                        config={config}
                        startupWarnings={startupWarnings}
                        version={version}
                        resumedSessionData={resumedSessionData}
                        initializationResult={initializationResult}
                      />
                    </VimModeProvider>
                  </SessionStatsProvider>
                </ScrollProvider>
              </MouseProvider>
            </KeypressProvider>
          </SettingsContext.Provider>
        );
      };
    

    See Mouse context

    This relies on some event parsing and input handling for mouse.

    Note: They updated scroll view as well to support mouse events: https://github.com/google-gemini/gemini-cli/blob/main/packages/cli/src/ui/contexts/ScrollProvider.tsx#L75

    Apparently there are specific mouse-related events that are also ANSI-escape-code-like:

    export const ESC = '\u001B';
    export const SGR_EVENT_PREFIX = `${ESC}[<`;
    export const X11_EVENT_PREFIX = `${ESC}[M`;
    
    // eslint-disable-next-line no-control-regex
    export const SGR_MOUSE_REGEX = /^\x1b\[<(\d+);(\d+);(\d+)([mM])/; // SGR mouse events
    // X11 is ESC [ M followed by 3 bytes.
    // eslint-disable-next-line no-control-regex
    export const X11_MOUSE_REGEX = /^\x1b\[M([\s\S]{3})/;
    

    This is where my journey stops for now. But apparently they did not use any external dependencies, we can either use several mouse event libraries I've found for TTY (like a regular javascript dev) or become 10x and follow the footsteps of the great.

     
  • Anonymous

    Anonymous - 2025-11-18

    Originally posted by: endernoke

    @supreme-gg-gg do you think we can ask the Gemini CLI devs to release their mouse scrollview etc. as npm packages (like how we did to ink-picture)

     

Log in to post a comment.

Monday.com Logo