class_docstr: Statemachine that receives :class:`KeyPress` instances and according to the
  key bindings in the given :class:`KeyBindings`, calls the matching handlers.
  
  ::
  
      p = KeyProcessor(key_bindings)
  
      # Send keys into the processor.
      p.feed(KeyPress(Keys.ControlX, ''))
      p.feed(KeyPress(Keys.ControlC, '')
  
      # Process all the keys in the queue.
      p.process_keys()
  
      # Now the ControlX-ControlC callback will be called if this sequence is
      # registered in the key bindings.
  
  :param key_bindings: `KeyBindingsBase` instance.
docstr: After every command, make sure that if we are in Vi navigation mode, we
  never put the cursor after the last character of a line. (Unless it's
  an empty line.)
docstr_tok: ["After","every","command",",","make","sure","that","if","we","are","in","Vi","navigation","mode",",","we","never","put","the","cursor","after","the","last","character","of","a","line",".","(","Unless","it's","an","empty","line",".",")"]
code: def _fix_vi_cursor_position(self, event: KeyPressEvent) -> None:
      """
      After every command, make sure that if we are in Vi navigation mode, we
      never put the cursor after the last character of a line. (Unless it's
      an empty line.)
      """
      app = event.app
      buff = app.current_buffer
      preferred_column = buff.preferred_column
  
      if (
          vi_navigation_mode()
          and buff.document.is_cursor_at_the_end_of_line
          and len(buff.document.current_line) > 0
      ):
          buff.cursor_position -= 1
  
          # Set the preferred_column for arrow up/down again.
          # (This was cleared after changing the cursor position.)
          buff.preferred_column = preferred_column
  
imports: from __future__ import annotations
  import weakref
  from asyncio import Task, sleep
  from collections import deque
  from typing import TYPE_CHECKING, Any, Generator
  from prompt_toolkit.application.current import get_app
  from prompt_toolkit.enums import EditingMode
  from prompt_toolkit.filters.app import vi_navigation_mode
  from prompt_toolkit.keys import Keys
  from prompt_toolkit.utils import Event
  from .key_bindings import Binding, KeyBindingsBase
label_desc: Use image node_id 11 for calling the KeyProcessor obj's underlying member method code with example usage: obj._fix_vi_cursor_position(event) without return types