class_docstr: :param vi_mode: Display '/' and '?' instead of I-search.
  :param ignore_case: Search case insensitive.
class_docstr_tok: [":","param","vi_mode",":","Display","'\/","'","and","'","?","'","instead","of","I-search",".",":","param","ignore_case",":","Search","case","insensitive","."]
code: def __init__(
      self,
      search_buffer: Buffer | None = None,
      vi_mode: bool = False,
      text_if_not_searching: AnyFormattedText = "",
      forward_search_prompt: AnyFormattedText = "I-search: ",
      backward_search_prompt: AnyFormattedText = "I-search backward: ",
      ignore_case: FilterOrBool = False,
  ) -> None:
      if search_buffer is None:
          search_buffer = Buffer()
  
      @Condition
      def is_searching() -> bool:
          return self.control in get_app().layout.search_links
  
      def get_before_input() -> AnyFormattedText:
          if not is_searching():
              return text_if_not_searching
          elif (
              self.control.searcher_search_state.direction
              == SearchDirection.BACKWARD
          ):
              return "?" if vi_mode else backward_search_prompt
          else:
              return "/" if vi_mode else forward_search_prompt
  
      self.search_buffer = search_buffer
  
      self.control = SearchBufferControl(
          buffer=search_buffer,
          input_processors=[
              BeforeInput(
                  get_before_input, style="class:search-toolbar.prompt"
              )
          ],
          lexer=SimpleLexer(style="class:search-toolbar.text"),
          ignore_case=ignore_case,
      )
  
      self.container = ConditionalContainer(
          content=Window(
              self.control, height=1, style="class:search-toolbar"
          ),
          filter=is_searching,
      )
  
imports: from __future__ import annotations
  from typing import Any
  from prompt_toolkit.application.current import get_app
  from prompt_toolkit.buffer import Buffer
  from prompt_toolkit.enums import SYSTEM_BUFFER
  from prompt_toolkit.filters import Condition, FilterOrBool, emacs_mode, has_arg, has_completions, has_focus, has_validation_error, to_filter, vi_mode, vi_navigation_mode
  from prompt_toolkit.formatted_text import AnyFormattedText, StyleAndTextTuples, fragment_list_len, to_formatted_text
  from prompt_toolkit.key_binding.key_bindings import ConditionalKeyBindings, KeyBindings, KeyBindingsBase, merge_key_bindings
  from prompt_toolkit.key_binding.key_processor import KeyPressEvent
  from prompt_toolkit.key_binding.vi_state import InputMode
  from prompt_toolkit.keys import Keys
  from prompt_toolkit.layout.containers import ConditionalContainer, Container, Window
  from prompt_toolkit.layout.controls import BufferControl, FormattedTextControl, SearchBufferControl, UIContent, UIControl
  from prompt_toolkit.layout.dimension import Dimension
  from prompt_toolkit.layout.processors import BeforeInput
  from prompt_toolkit.lexers import SimpleLexer
  from prompt_toolkit.search import SearchDirection
label_desc: Use image node_id 1 to create a new SearchToolbar object  with example: obj = SearchToolbar(search_buffer, vi_mode, text_if_not_searching, forward_search_prompt, backward_search_prompt, ignore_case)