class_docstr: Control for visualising the content of a `Buffer`.
  
  :param input_processors: list of :class:`~prompt_toolkit.layout.processors.Processor`.
  :param lexer: :class:`~prompt_toolkit.layout.lexers.Lexer` instance for syntax highlighting.
  :param preview_search: `bool` or `CLIFilter`: Show search while typing.
  :param get_search_state: Callable that takes a CommandLineInterface and
      returns the SearchState to be used. (If not CommandLineInterface.search_state.)
  :param buffer_name: String representing the name of the buffer to display.
  :param default_char: :class:`.Char` instance to use to fill the background. This is
      transparent by default.
  :param focus_on_click: Focus this buffer when it's click, but not yet focussed.
class_docstr_tok: ["Control","for","visualising","the","content","of","a","`","Buffer","`",".",":","param","input_processors",":","list","of",":","class",":","`","~prompt_toolkit.layout.processors.Processor","`",".",":","param","lexer",":",":","class",":","`","~prompt_toolkit.layout.lexers.Lexer","`","instance","for","syntax","highlighting",".",":","param","preview_search",":","`","bool","`","or","`","CLIFilter","`",":","Show","search","while","typing",".",":","param","get_search_state",":","Callable","that","takes","a","CommandLineInterface","and","returns","the","SearchState","to","be","used",".","(","If","not","CommandLineInterface.search_state",".",")",":","param","buffer_name",":","String","representing","the","name","of","the","buffer","to","display",".",":","param","default_char",":",":","class",":","`",".Char","`","instance","to","use","to","fill","the","background",".","This","is","transparent","by","default",".",":","param","focus_on_click",":","Focus","this","buffer","when","it","'s","click",",","but","not","yet","focussed","."]
docstr: Create a UIContent.
docstr_tok: ["Create","a","UIContent","."]
code: def create_content(self, cli, width, height):
      """
      Create a UIContent.
      """
      buffer = self._buffer(cli)
  
      # Get the document to be shown. If we are currently searching (the
      # search buffer has focus, and the preview_search filter is enabled),
      # then use the search document, which has possibly a different
      # text/cursor position.)
      def preview_now():
          """True when we should preview a search."""
          return bool(
              self.preview_search(cli)
              and cli.buffers[self.search_buffer_name].text
          )
  
      if preview_now():
          if self.get_search_state:
              ss = self.get_search_state(cli)
          else:
              ss = cli.search_state
  
          document = buffer.document_for_search(
              SearchState(
                  text=cli.current_buffer.text,
                  direction=ss.direction,
                  ignore_case=ss.ignore_case,
              )
          )
      else:
          document = buffer.document
  
      get_processed_line = self._create_get_processed_line_func(
          cli, document
      )
      self._last_get_processed_line = get_processed_line
  
      def translate_rowcol(row, col):
          "Return the content column for this coordinate."
          return Point(
              y=row, x=get_processed_line(row).source_to_display(col)
          )
  
      def get_line(i):
          "Return the tokens for a given line number."
          tokens = get_processed_line(i).tokens
  
          # Add a space at the end, because that is a possible cursor
          # position. (When inserting after the input.) We should do this on
          # all the lines, not just the line containing the cursor. (Because
          # otherwise, line wrapping/scrolling could change when moving the
          # cursor around.)
          tokens = tokens + [(self.default_char.token, " ")]
          return tokens
  
      content = UIContent(
          get_line=get_line,
          line_count=document.line_count,
          cursor_position=translate_rowcol(
              document.cursor_position_row, document.cursor_position_col
          ),
          default_char=self.default_char,
      )
  
      # If there is an auto completion going on, use that start point for a
      # pop-up menu position. (But only when this buffer has the focus --
      # there is only one place for a menu, determined by the focussed buffer.)
      if cli.current_buffer_name == self.buffer_name:
          menu_position = (
              self.menu_position(cli) if self.menu_position else None
          )
          if menu_position is not None:
              assert isinstance(menu_position, int)
              (
                  menu_row,
                  menu_col,
              ) = buffer.document.translate_index_to_position(
                  menu_position
              )
              content.menu_position = translate_rowcol(
                  menu_row, menu_col
              )
          elif buffer.complete_state:
              # Position for completion menu.
              # Note: We use 'min', because the original cursor position could be
              #       behind the input string when the actual completion is for
              #       some reason shorter than the text we had before. (A completion
              #       can change and shorten the input.)
              (
                  menu_row,
                  menu_col,
              ) = buffer.document.translate_index_to_position(
                  min(
                      buffer.cursor_position,
                      buffer.complete_state.original_document.cursor_position,
                  )
              )
              content.menu_position = translate_rowcol(
                  menu_row, menu_col
              )
          else:
              content.menu_position = None
  
      return content
  
imports: from __future__ import unicode_literals
  from abc import ABCMeta, abstractmethod
  from collections import namedtuple
  from six import with_metaclass
  from six.moves import range
  from prompt_toolkit.cache import SimpleCache
  from prompt_toolkit.enums import DEFAULT_BUFFER, SEARCH_BUFFER
  from prompt_toolkit.filters import to_cli_filter
  from prompt_toolkit.mouse_events import MouseEventType
  from prompt_toolkit.search_state import SearchState
  from prompt_toolkit.selection import SelectionType
  from prompt_toolkit.token import Token
  from prompt_toolkit.utils import get_cwidth
  from .lexers import Lexer, SimpleLexer
  from .processors import Processor
  from .screen import Char, Point
  from .utils import token_list_width, split_lines, token_list_to_text
  import six
  import time
label_desc: Use image node_id 8 for calling the BufferControl obj's underlying member method code with example usage: obj.create_content(cli, width, height) and returns: content, bool, Point, tokens