class_docstr: Completion menu that displays all the completions in several columns.
  When there are more completions than space for them to be displayed, an
  arrow is shown on the left or right side.
  
  `min_rows` indicates how many rows will be available in any possible case.
  When this is larger than one, it will try to use less columns and more
  rows until this value is reached.
  Be careful passing in a too big value, if less than the given amount of
  rows are available, more columns would have been required, but
  `preferred_width` doesn't know about that and reports a too small value.
  This results in less completions displayed and additional scrolling.
  (It's a limitation of how the layout engine currently works: first the
  widths are calculated, then the heights.)
  
  :param suggested_max_column_width: The suggested max width of a column.
      The column can still be bigger than this, but if there is place for two
      columns of this width, we will display two columns. This to avoid that
      if there is one very wide completion, that it doesn't significantly
      reduce the amount of columns.
class_docstr_tok: ["Completion","menu","that","displays","all","the","completions","in","several","columns",".","When","there","are","more","completions","than","space","for","them","to","be","displayed",",","an","arrow","is","shown","on","the","left","or","right","side",".","`","min_rows","`","indicates","how","many","rows","will","be","available","in","any","possible","case",".","When","this","is","larger","than","one",",","it","will","try","to","use","less","columns","and","more","rows","until","this","value","is","reached",".","Be","careful","passing","in","a","too","big","value",",","if","less","than","the","given","amount","of","rows","are","available",",","more","columns","would","have","been","required",",","but","`","preferred_width","`","does","n't","know","about","that","and","reports","a","too","small","value",".","This","results","in","less","completions","displayed","and","additional","scrolling",".","(","It","'s","a","limitation","of","how","the","layout","engine","currently","works",":","first","the","widths","are","calculated",",","then","the","heights",".",")",":","param","suggested_max_column_width",":","The","suggested","max","width","of","a","column",".","The","column","can","still","be","bigger","than","this",",","but","if","there","is","place","for","two","columns","of","this","width",",","we","will","display","two","columns",".","This","to","avoid","that","if","there","is","one","very","wide","completion",",","that","it","does","n't","significantly","reduce","the","amount","of","columns","."]
docstr: Create a UIContent object for this menu.
code: def create_content(self, width: int, height: int) -> UIContent:
      """
      Create a UIContent object for this menu.
      """
      complete_state = get_app().current_buffer.complete_state
      if complete_state is None:
          return UIContent()
  
      column_width = self._get_column_width(complete_state)
      self._render_pos_to_completion = {}
  
      _T = TypeVar("_T")
  
      def grouper(
          n: int, iterable: Iterable[_T], fillvalue: _T | None = None
      ) -> Iterable[Sequence[_T | None]]:
          "grouper(3, 'ABCDEFG', 'x') --> ABC DEF Gxx"
          args = [iter(iterable)] * n
          return zip_longest(fillvalue=fillvalue, *args)
  
      def is_current_completion(completion: Completion) -> bool:
          "Returns True when this completion is the currently selected one."
          return (
              complete_state is not None
              and complete_state.complete_index is not None
              and c == complete_state.current_completion
          )
  
      # Space required outside of the regular columns, for displaying the
      # left and right arrow.
      HORIZONTAL_MARGIN_REQUIRED = 3
  
      # There should be at least one column, but it cannot be wider than
      # the available width.
      column_width = min(
          width - HORIZONTAL_MARGIN_REQUIRED, column_width
      )
  
      # However, when the columns tend to be very wide, because there are
      # some very wide entries, shrink it anyway.
      if column_width > self.suggested_max_column_width:
          # `column_width` can still be bigger that `suggested_max_column_width`,
          # but if there is place for two columns, we divide by two.
          column_width //= (
              column_width // self.suggested_max_column_width
          )
  
      visible_columns = max(
          1, (width - self._required_margin) // column_width
      )
  
      columns_ = list(grouper(height, complete_state.completions))
      rows_ = list(zip(*columns_))
  
      # Make sure the current completion is always visible: update scroll offset.
      selected_column = (complete_state.complete_index or 0) // height
      self.scroll = min(
          selected_column,
          max(self.scroll, selected_column - visible_columns + 1),
      )
  
      render_left_arrow = self.scroll > 0
      render_right_arrow = self.scroll < len(rows_[0]) - visible_columns
  
      # Write completions to screen.
      fragments_for_line = []
  
      for row_index, row in enumerate(rows_):
          fragments: StyleAndTextTuples = []
          middle_row = row_index == len(rows_) // 2
  
          # Draw left arrow if we have hidden completions on the left.
          if render_left_arrow:
              fragments.append(
                  ("class:scrollbar", "<" if middle_row else " ")
              )
          elif render_right_arrow:
              # Reserve one column empty space. (If there is a right
              # arrow right now, there can be a left arrow as well.)
              fragments.append(("", " "))
  
          # Draw row content.
          for column_index, c in enumerate(
              row[self.scroll :][:visible_columns]
          ):
              if c is not None:
                  fragments += _get_menu_item_fragments(
                      c,
                      is_current_completion(c),
                      column_width,
                      space_after=False,
                  )
  
                  # Remember render position for mouse click handler.
                  for x in range(column_width):
                      self._render_pos_to_completion[
                          (column_index * column_width + x, row_index)
                      ] = c
              else:
                  fragments.append(
                      ("class:completion", " " * column_width)
                  )
  
          # Draw trailing padding for this row.
          # (_get_menu_item_fragments only returns padding on the left.)
          if render_left_arrow or render_right_arrow:
              fragments.append(("class:completion", " "))
  
          # Draw right arrow if we have hidden completions on the right.
          if render_right_arrow:
              fragments.append(
                  ("class:scrollbar", ">" if middle_row else " ")
              )
          elif render_left_arrow:
              fragments.append(("class:completion", " "))
  
          # Add line.
          fragments_for_line.append(
              to_formatted_text(
                  fragments, style="class:completion-menu"
              )
          )
  
      self._rendered_rows = height
      self._rendered_columns = visible_columns
      self._total_columns = len(columns_)
      self._render_left_arrow = render_left_arrow
      self._render_right_arrow = render_right_arrow
      self._render_width = (
          column_width * visible_columns
          + render_left_arrow
          + render_right_arrow
          + 1
      )
  
      def get_line(i: int) -> StyleAndTextTuples:
          return fragments_for_line[i]
  
      return UIContent(get_line=get_line, line_count=len(rows_))
  
imports: from __future__ import annotations
  import math
  from itertools import zip_longest
  from typing import TYPE_CHECKING, Callable, Iterable, Sequence, TypeVar, cast
  from weakref import WeakKeyDictionary
  from prompt_toolkit.application.current import get_app
  from prompt_toolkit.buffer import CompletionState
  from prompt_toolkit.completion import Completion
  from prompt_toolkit.data_structures import Point
  from prompt_toolkit.filters import Condition, FilterOrBool, has_completions, is_done, to_filter
  from prompt_toolkit.formatted_text import StyleAndTextTuples, fragment_list_width, to_formatted_text
  from prompt_toolkit.key_binding.key_processor import KeyPressEvent
  from prompt_toolkit.layout.utils import explode_text_fragments
  from prompt_toolkit.mouse_events import MouseEvent, MouseEventType
  from prompt_toolkit.utils import get_cwidth
  from .containers import ConditionalContainer, HSplit, ScrollOffsets, Window
  from .controls import GetLinePrefixCallable, UIContent, UIControl
  from .dimension import Dimension
  from .margins import ScrollbarMargin
label_desc: Use image node_id 6 for calling the MultiColumnCompletionMenuControl obj's underlying member method code with example usage: obj.create_content(width, height) and returns: UIContent, UIContent, zip_longest, unknown, fragments_for_line