class_docstr: :param recognize_paste: When True, try to discover paste actions and turn
      the event into a BracketedPaste.
docstr: Handle mouse events. Return a list of KeyPress instances.
docstr_tok: ["Handle","mouse","events",".","Return","a","list","of","KeyPress","instances","."]
code: def _handle_mouse(self, ev: MOUSE_EVENT_RECORD) -> list[KeyPress]:
      """
      Handle mouse events. Return a list of KeyPress instances.
      """
      event_flags = ev.EventFlags
      button_state = ev.ButtonState
  
      event_type: MouseEventType | None = None
      button: MouseButton = MouseButton.NONE
  
      # Scroll events.
      if event_flags & MOUSE_WHEELED:
          if button_state > 0:
              event_type = MouseEventType.SCROLL_UP
          else:
              event_type = MouseEventType.SCROLL_DOWN
      else:
          # Handle button state for non-scroll events.
          if button_state == FROM_LEFT_1ST_BUTTON_PRESSED:
              button = MouseButton.LEFT
  
          elif button_state == RIGHTMOST_BUTTON_PRESSED:
              button = MouseButton.RIGHT
  
      # Move events.
      if event_flags & MOUSE_MOVED:
          event_type = MouseEventType.MOUSE_MOVE
  
      # No key pressed anymore: mouse up.
      if event_type is None:
          if button_state > 0:
              # Some button pressed.
              event_type = MouseEventType.MOUSE_DOWN
          else:
              # No button pressed.
              event_type = MouseEventType.MOUSE_UP
  
      data = ";".join(
          [
              button.value,
              event_type.value,
              str(ev.MousePosition.X),
              str(ev.MousePosition.Y),
          ]
      )
      return [KeyPress(Keys.WindowsMouseEvent, data)]
  
imports: from __future__ import annotations
  import os
  import sys
  from abc import abstractmethod
  from asyncio import get_running_loop
  from contextlib import contextmanager
  from ..utils import SPHINX_AUTODOC_RUNNING
  from ctypes import Array, pointer
  from ctypes.wintypes import DWORD, HANDLE
  from typing import Callable, ContextManager, Iterable, Iterator, TextIO
  from prompt_toolkit.eventloop import run_in_executor_with_context
  from prompt_toolkit.eventloop.win32 import create_win32_event, wait_for_handles
  from prompt_toolkit.key_binding.key_processor import KeyPress
  from prompt_toolkit.keys import Keys
  from prompt_toolkit.mouse_events import MouseButton, MouseEventType
  from prompt_toolkit.win32_types import INPUT_RECORD, KEY_EVENT_RECORD, MOUSE_EVENT_RECORD, STD_INPUT_HANDLE, EventTypes
  from .ansi_escape_sequences import REVERSE_ANSI_SEQUENCES
  from .base import Input
label_desc: Use image node_id 9 for calling the ConsoleInputReader obj's underlying member method code with example usage: obj._handle_mouse(ev) and returns: list