code: def mouse_handler(self, cli, mouse_event):
          
          b = cli.current_buffer
  
          if mouse_event.event_type == MouseEventType.MOUSE_UP:
              # Select completion.
              b.go_to_completion(mouse_event.position.y)
              b.complete_state = None
  
          elif mouse_event.event_type == MouseEventType.SCROLL_DOWN:
              # Scroll up.
              b.complete_next(count=3, disable_wrap_around=True)
  
          elif mouse_event.event_type == MouseEventType.SCROLL_UP:
              # Scroll down.
              b.complete_previous(count=3, disable_wrap_around=True)
docs: Handle mouse events: clicking and scrolling.