LLVMFuzzerTestOneInput:
    8|    115|{
    9|    115|  Terminal::Display display( false );
   10|    115|  Terminal::Complete complete( 80, 24 );
   11|    115|  Terminal::Framebuffer state( 80, 24 );
   12|  4.19M|  for ( size_t i = 0; i < size; i++ ) {
  ------------------
  |  Branch (12:23): [True: 4.19M, False: 115]
  ------------------
   13|  4.19M|    complete.act( Parser::UserByte( data[i] ) );
   14|  4.19M|  }
   15|    115|  display.new_frame( true, state, complete.get_fb() );
   16|       |
   17|    115|  return 0;
   18|    115|}

_ZN11HostBuffers7EchoAck16default_instanceEv:
  876|      4|  static const EchoAck& default_instance() {
  877|      4|    return *internal_default_instance();
  878|      4|  }
_ZN11HostBuffers7EchoAck25internal_default_instanceEv:
  879|      4|  static inline const EchoAck* internal_default_instance() {
  880|      4|    return reinterpret_cast<const EchoAck*>(
  881|      4|               &_EchoAck_default_instance_);
  882|      4|  }
_ZN11HostBuffers13ResizeMessage16default_instanceEv:
  719|      4|  static const ResizeMessage& default_instance() {
  720|      4|    return *internal_default_instance();
  721|      4|  }
_ZN11HostBuffers13ResizeMessage25internal_default_instanceEv:
  722|      4|  static inline const ResizeMessage* internal_default_instance() {
  723|      4|    return reinterpret_cast<const ResizeMessage*>(
  724|      4|               &_ResizeMessage_default_instance_);
  725|      4|  }
_ZN11HostBuffers9HostBytes16default_instanceEv:
  572|      4|  static const HostBytes& default_instance() {
  573|      4|    return *internal_default_instance();
  574|      4|  }
_ZN11HostBuffers9HostBytes25internal_default_instanceEv:
  575|      4|  static inline const HostBytes* internal_default_instance() {
  576|      4|    return reinterpret_cast<const HostBytes*>(
  577|      4|               &_HostBytes_default_instance_);
  578|      4|  }
_ZN11HostBuffers11Instruction16default_instanceEv:
  256|      6|  static const Instruction& default_instance() {
  257|      6|    return *internal_default_instance();
  258|      6|  }
_ZN11HostBuffers11Instruction25internal_default_instanceEv:
  259|      6|  static inline const Instruction* internal_default_instance() {
  260|      6|    return reinterpret_cast<const Instruction*>(
  261|      6|               &_Instruction_default_instance_);
  262|      6|  }

_ZN8Terminal8Complete3actB5cxx11ERKN6Parser6ActionE:
   62|  4.19M|{
   63|       |  /* apply action to terminal */
   64|  4.19M|  act.act_on_terminal( &terminal );
   65|  4.19M|  return terminal.read_octets_to_host();
   66|  4.19M|}

_ZN8Terminal8CompleteC2Emm:
   65|    115|    : parser(), terminal( width, height ), display( false ), actions(), input_history(), echo_ack( 0 )
   66|    115|  {}
_ZNK8Terminal8Complete6get_fbEv:
   71|    115|  const Framebuffer& get_fb( void ) const { return terminal.get_fb(); }

_ZN6Parser10UTF8ParserC2Ev:
   68|    115|Parser::UTF8Parser::UTF8Parser() : parser(), buf_len( 0 )
   69|    115|{
   70|    115|  assert( BUF_SIZE >= (size_t)MB_CUR_MAX );
  ------------------
  |  Branch (70:3): [True: 115, False: 0]
  ------------------
   71|    115|  buf[0] = '\0';
   72|    115|}

_ZN6Parser6ParserD2Ev:
   60|    115|  ~Parser() {}
_ZN6Parser6ParserC2Ev:
   56|    115|  Parser() : state( &family.s_Ground ) {}

_ZNK6Parser8UserByte15act_on_terminalEPN8Terminal8EmulatorE:
   92|  4.19M|{
   93|  4.19M|  emu->dispatch.terminal_to_host.append( emu->user.input( this, emu->fb.ds.application_mode_cursor_keys ) );
   94|  4.19M|}

_ZN6Parser8UserByteC2Ei:
  155|  4.19M|  UserByte( int s_c ) : c( s_c ) {}
_ZN6Parser6ActionC2Ev:
   57|  4.19M|  Action() : ch( -1 ), char_present( false ) {};
_ZN6Parser6ActionD2Ev:
   58|  4.19M|  virtual ~Action() {};

_ZN6Parser5State9setfamilyEPNS_11StateFamilyE:
   51|     28|  void setfamily( StateFamily* s_family ) { family = s_family; }
_ZN6Parser5StateC2Ev:
   56|     28|  State() : family( NULL ) {};

_ZN6Parser11StateFamilyC2Ev:
   62|      2|    : s_Ground(), s_Escape(), s_Escape_Intermediate(), s_CSI_Entry(), s_CSI_Param(), s_CSI_Intermediate(),
   63|      2|      s_CSI_Ignore(), s_DCS_Entry(), s_DCS_Param(), s_DCS_Intermediate(), s_DCS_Passthrough(), s_DCS_Ignore(),
   64|      2|      s_OSC_String(), s_SOS_PM_APC_String()
   65|      2|  {
   66|      2|    s_Ground.setfamily( this );
   67|      2|    s_Escape.setfamily( this );
   68|      2|    s_Escape_Intermediate.setfamily( this );
   69|      2|    s_CSI_Entry.setfamily( this );
   70|      2|    s_CSI_Param.setfamily( this );
   71|      2|    s_CSI_Intermediate.setfamily( this );
   72|      2|    s_CSI_Ignore.setfamily( this );
   73|      2|    s_DCS_Entry.setfamily( this );
   74|      2|    s_DCS_Param.setfamily( this );
   75|      2|    s_DCS_Intermediate.setfamily( this );
   76|      2|    s_DCS_Passthrough.setfamily( this );
   77|      2|    s_DCS_Ignore.setfamily( this );
   78|      2|    s_OSC_String.setfamily( this );
   79|      2|    s_SOS_PM_APC_String.setfamily( this );
   80|      2|  }

_ZN8Terminal8EmulatorC2Emm:
   44|    115|Emulator::Emulator( size_t s_width, size_t s_height ) : fb( s_width, s_height ), dispatch(), user() {}
_ZN8Terminal8Emulator19read_octets_to_hostB5cxx11Ev:
   47|  4.19M|{
   48|  4.19M|  std::string ret = dispatch.terminal_to_host;
   49|  4.19M|  dispatch.terminal_to_host.clear();
   50|  4.19M|  return ret;
   51|  4.19M|}

_ZNK8Terminal8Emulator6get_fbEv:
   82|    115|  const Framebuffer& get_fb( void ) const { return fb; }

_ZN8Terminal10DispatcherC2Ev:
   48|    115|  : params(), parsed_params(), parsed( false ), dispatch_chars(), OSC_string(), terminal_to_host()
   49|    115|{}
_ZN8Terminal28get_global_dispatch_registryEv:
  168|     92|{
  169|     92|  static DispatchRegistry global_dispatch_registry;
  170|     92|  return global_dispatch_registry;
  171|     92|}
_ZN8Terminal8FunctionC2ENS_13Function_TypeERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPFvPNS_11FramebufferEPNS_10DispatcherEEb:
  192|     92|  : function( s_function ), clears_wrap_state( s_clears_wrap_state )
  193|     92|{
  194|     92|  register_function( type, dispatch_chars, *this );
  195|     92|}
terminaldispatcher.cc:_ZL17register_functionN8Terminal13Function_TypeERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEENS_8FunctionE:
  174|     92|{
  175|     92|  switch ( type ) {
  ------------------
  |  Branch (175:12): [True: 92, False: 0]
  ------------------
  176|      8|    case ESCAPE:
  ------------------
  |  Branch (176:5): [True: 8, False: 84]
  ------------------
  177|      8|      get_global_dispatch_registry().escape.insert( dispatch_map_t::value_type( dispatch_chars, f ) );
  178|      8|      break;
  179|     62|    case CSI:
  ------------------
  |  Branch (179:5): [True: 62, False: 30]
  ------------------
  180|     62|      get_global_dispatch_registry().CSI.insert( dispatch_map_t::value_type( dispatch_chars, f ) );
  181|     62|      break;
  182|     22|    case CONTROL:
  ------------------
  |  Branch (182:5): [True: 22, False: 70]
  ------------------
  183|     22|      get_global_dispatch_registry().control.insert( dispatch_map_t::value_type( dispatch_chars, f ) );
  184|     22|      break;
  185|     92|  }
  186|     92|}

_ZN8Terminal16DispatchRegistryC2Ev:
   85|      2|  DispatchRegistry() : escape(), CSI(), control() {}

_ZNK8Terminal7Display9new_frameB5cxx11EbRKNS_11FramebufferES3_:
   62|    115|{
   63|    115|  FrameState frame( last );
   64|       |
   65|    115|  char tmp[64];
   66|       |
   67|       |  /* has bell been rung? */
   68|    115|  if ( f.get_bell_count() != frame.last_frame.get_bell_count() ) {
  ------------------
  |  Branch (68:8): [True: 0, False: 115]
  ------------------
   69|      0|    frame.append( '\007' );
   70|      0|  }
   71|    115|  using title_type = Terminal::Framebuffer::title_type;
   72|       |
   73|       |  /* has icon name or window title changed? */
   74|    115|  if ( has_title && f.is_title_initialized()
  ------------------
  |  Branch (74:8): [True: 115, False: 0]
  |  Branch (74:21): [True: 0, False: 115]
  ------------------
   75|      0|       && ( ( !initialized ) || ( f.get_icon_name() != frame.last_frame.get_icon_name() )
  ------------------
  |  Branch (75:13): [True: 0, False: 0]
  |  Branch (75:33): [True: 0, False: 0]
  ------------------
   76|      0|            || ( f.get_window_title() != frame.last_frame.get_window_title() ) ) ) {
  ------------------
  |  Branch (76:16): [True: 0, False: 0]
  ------------------
   77|       |    /* set icon name and window title */
   78|      0|    if ( f.get_icon_name() == f.get_window_title() ) {
  ------------------
  |  Branch (78:10): [True: 0, False: 0]
  ------------------
   79|       |      /* write combined Icon Name and Window Title */
   80|      0|      frame.append( "\033]0;" );
   81|      0|      const title_type& window_title( f.get_window_title() );
   82|      0|      for ( title_type::const_iterator i = window_title.begin(); i != window_title.end(); i++ ) {
  ------------------
  |  Branch (82:66): [True: 0, False: 0]
  ------------------
   83|      0|        frame.append( *i );
   84|      0|      }
   85|      0|      frame.append( '\007' );
   86|       |      /* ST is more correct, but BEL more widely supported */
   87|      0|    } else {
   88|       |      /* write Icon Name */
   89|      0|      frame.append( "\033]1;" );
   90|      0|      const title_type& icon_name( f.get_icon_name() );
   91|      0|      for ( title_type::const_iterator i = icon_name.begin(); i != icon_name.end(); i++ ) {
  ------------------
  |  Branch (91:63): [True: 0, False: 0]
  ------------------
   92|      0|        frame.append( *i );
   93|      0|      }
   94|      0|      frame.append( '\007' );
   95|       |
   96|      0|      frame.append( "\033]2;" );
   97|      0|      const title_type& window_title( f.get_window_title() );
   98|      0|      for ( title_type::const_iterator i = window_title.begin(); i != window_title.end(); i++ ) {
  ------------------
  |  Branch (98:66): [True: 0, False: 0]
  ------------------
   99|      0|        frame.append( *i );
  100|      0|      }
  101|      0|      frame.append( '\007' );
  102|      0|    }
  103|      0|  }
  104|       |
  105|       |  /* has clipboard changed? */
  106|    115|  if ( f.get_clipboard() != frame.last_frame.get_clipboard() ) {
  ------------------
  |  Branch (106:8): [True: 0, False: 115]
  ------------------
  107|      0|    frame.append( "\033]52;c;" );
  108|      0|    const title_type& clipboard( f.get_clipboard() );
  109|      0|    for ( title_type::const_iterator i = clipboard.begin(); i != clipboard.end(); i++ ) {
  ------------------
  |  Branch (109:61): [True: 0, False: 0]
  ------------------
  110|      0|      frame.append( *i );
  111|      0|    }
  112|      0|    frame.append( '\007' );
  113|      0|  }
  114|       |
  115|       |  /* has reverse video state changed? */
  116|    115|  if ( ( !initialized ) || ( f.ds.reverse_video != frame.last_frame.ds.reverse_video ) ) {
  ------------------
  |  Branch (116:8): [True: 0, False: 115]
  |  Branch (116:28): [True: 0, False: 115]
  ------------------
  117|       |    /* set reverse video */
  118|      0|    snprintf( tmp, 64, "\033[?5%c", ( f.ds.reverse_video ? 'h' : 'l' ) );
  ------------------
  |  Branch (118:39): [True: 0, False: 0]
  ------------------
  119|      0|    frame.append( tmp );
  120|      0|  }
  121|       |
  122|       |  /* has size changed? */
  123|    115|  if ( ( !initialized ) || ( f.ds.get_width() != frame.last_frame.ds.get_width() )
  ------------------
  |  Branch (123:8): [True: 0, False: 115]
  |  Branch (123:28): [True: 0, False: 115]
  ------------------
  124|    115|       || ( f.ds.get_height() != frame.last_frame.ds.get_height() ) ) {
  ------------------
  |  Branch (124:11): [True: 0, False: 115]
  ------------------
  125|       |    /* reset scrolling region */
  126|      0|    frame.append( "\033[r" );
  127|       |
  128|       |    /* clear screen */
  129|      0|    frame.append( "\033[0m\033[H\033[2J" );
  130|      0|    initialized = false;
  131|      0|    frame.cursor_x = frame.cursor_y = 0;
  132|      0|    frame.current_rendition = initial_rendition();
  133|      0|    frame.current_hyperlink = Hyperlink();
  134|    115|  } else {
  135|    115|    frame.cursor_x = frame.last_frame.ds.get_cursor_col();
  136|    115|    frame.cursor_y = frame.last_frame.ds.get_cursor_row();
  137|    115|    frame.current_rendition = frame.last_frame.ds.get_renditions();
  138|    115|    frame.current_hyperlink = frame.last_frame.ds.get_hyperlink();
  139|    115|  }
  140|       |
  141|       |  /* is cursor visibility initialized? */
  142|    115|  if ( !initialized ) {
  ------------------
  |  Branch (142:8): [True: 0, False: 115]
  ------------------
  143|      0|    frame.cursor_visible = false;
  144|      0|    frame.append( "\033[?25l" );
  145|      0|  }
  146|       |
  147|    115|  int frame_y = 0;
  148|    115|  Framebuffer::row_pointer blank_row;
  149|    115|  Framebuffer::rows_type rows( frame.last_frame.get_rows() );
  150|       |  /* Extend rows if we've gotten a resize and new is wider than old */
  151|    115|  if ( frame.last_frame.ds.get_width() < f.ds.get_width() ) {
  ------------------
  |  Branch (151:8): [True: 0, False: 115]
  ------------------
  152|      0|    for ( Framebuffer::rows_type::iterator p = rows.begin(); p != rows.end(); p++ ) {
  ------------------
  |  Branch (152:62): [True: 0, False: 0]
  ------------------
  153|      0|      *p = std::make_shared<Row>( **p );
  154|      0|      ( *p )->cells.resize( f.ds.get_width(), Cell( f.ds.get_background_rendition() ) );
  155|      0|    }
  156|      0|  }
  157|       |  /* Add rows if we've gotten a resize and new is taller than old */
  158|    115|  if ( static_cast<int>( rows.size() ) < f.ds.get_height() ) {
  ------------------
  |  Branch (158:8): [True: 0, False: 115]
  ------------------
  159|       |    // get a proper blank row
  160|      0|    const size_t w = f.ds.get_width();
  161|      0|    const color_type c = 0;
  162|      0|    blank_row = std::make_shared<Row>( w, c );
  163|      0|    rows.resize( f.ds.get_height(), blank_row );
  164|      0|  }
  165|       |
  166|       |  /* shortcut -- has display moved up by a certain number of lines? */
  167|    115|  if ( initialized ) {
  ------------------
  |  Branch (167:8): [True: 115, False: 0]
  ------------------
  168|    115|    int lines_scrolled = 0;
  169|    115|    int scroll_height = 0;
  170|       |
  171|  2.87k|    for ( int row = 0; row < f.ds.get_height(); row++ ) {
  ------------------
  |  Branch (171:24): [True: 2.76k, False: 115]
  ------------------
  172|  2.76k|      const Row* new_row = f.get_row( 0 );
  173|  2.76k|      const Row* old_row = &*rows.at( row );
  174|  2.76k|      if ( !( new_row == old_row || *new_row == *old_row ) ) {
  ------------------
  |  Branch (174:15): [True: 0, False: 2.76k]
  |  Branch (174:37): [True: 0, False: 2.76k]
  ------------------
  175|  2.76k|        continue;
  176|  2.76k|      }
  177|       |      /* if row 0, we're looking at ourselves and probably didn't scroll */
  178|      0|      if ( row == 0 ) {
  ------------------
  |  Branch (178:12): [True: 0, False: 0]
  ------------------
  179|      0|        break;
  180|      0|      }
  181|       |      /* found a scroll */
  182|      0|      lines_scrolled = row;
  183|      0|      scroll_height = 1;
  184|       |
  185|       |      /* how big is the region that was scrolled? */
  186|      0|      for ( int region_height = 1; lines_scrolled + region_height < f.ds.get_height(); region_height++ ) {
  ------------------
  |  Branch (186:36): [True: 0, False: 0]
  ------------------
  187|      0|        if ( *f.get_row( region_height ) == *rows.at( lines_scrolled + region_height ) ) {
  ------------------
  |  Branch (187:14): [True: 0, False: 0]
  ------------------
  188|      0|          scroll_height = region_height + 1;
  189|      0|        } else {
  190|      0|          break;
  191|      0|        }
  192|      0|      }
  193|       |
  194|      0|      break;
  195|      0|    }
  196|       |
  197|    115|    if ( scroll_height ) {
  ------------------
  |  Branch (197:10): [True: 0, False: 115]
  ------------------
  198|      0|      frame_y = scroll_height;
  199|       |
  200|      0|      if ( lines_scrolled ) {
  ------------------
  |  Branch (200:12): [True: 0, False: 0]
  ------------------
  201|       |        /* Now we need a proper blank row. */
  202|      0|        if ( blank_row.get() == NULL ) {
  ------------------
  |  Branch (202:14): [True: 0, False: 0]
  ------------------
  203|      0|          const size_t w = f.ds.get_width();
  204|      0|          const color_type c = 0;
  205|      0|          blank_row = std::make_shared<Row>( w, c );
  206|      0|        }
  207|      0|        frame.update_rendition( initial_rendition(), true );
  208|      0|        frame.update_hyperlink( Hyperlink(), true );
  209|       |
  210|      0|        int top_margin = 0;
  211|      0|        int bottom_margin = top_margin + lines_scrolled + scroll_height - 1;
  212|       |
  213|      0|        assert( bottom_margin < f.ds.get_height() );
  ------------------
  |  Branch (213:9): [True: 0, False: 0]
  ------------------
  214|       |
  215|       |        /* Common case:  if we're already on the bottom line and we're scrolling the whole
  216|       |         * screen, just do a CR and LFs.
  217|       |         */
  218|      0|        if ( scroll_height + lines_scrolled == f.ds.get_height() && frame.cursor_y + 1 == f.ds.get_height() ) {
  ------------------
  |  Branch (218:14): [True: 0, False: 0]
  |  Branch (218:69): [True: 0, False: 0]
  ------------------
  219|      0|          frame.append( '\r' );
  220|      0|          frame.append( lines_scrolled, '\n' );
  221|      0|          frame.cursor_x = 0;
  222|      0|        } else {
  223|       |          /* set scrolling region */
  224|      0|          snprintf( tmp, 64, "\033[%d;%dr", top_margin + 1, bottom_margin + 1 );
  225|      0|          frame.append( tmp );
  226|       |
  227|       |          /* go to bottom of scrolling region */
  228|      0|          frame.cursor_x = frame.cursor_y = -1;
  229|      0|          frame.append_silent_move( bottom_margin, 0 );
  230|       |
  231|       |          /* scroll */
  232|      0|          frame.append( lines_scrolled, '\n' );
  233|       |
  234|       |          /* reset scrolling region */
  235|      0|          frame.append( "\033[r" );
  236|       |          /* invalidate cursor position after unsetting scrolling region */
  237|      0|          frame.cursor_x = frame.cursor_y = -1;
  238|      0|        }
  239|       |
  240|       |        /* do the move in our local index */
  241|      0|        for ( int i = top_margin; i <= bottom_margin; i++ ) {
  ------------------
  |  Branch (241:35): [True: 0, False: 0]
  ------------------
  242|      0|          if ( i + lines_scrolled <= bottom_margin ) {
  ------------------
  |  Branch (242:16): [True: 0, False: 0]
  ------------------
  243|      0|            rows.at( i ) = rows.at( i + lines_scrolled );
  244|      0|          } else {
  245|      0|            rows.at( i ) = blank_row;
  246|      0|          }
  247|      0|        }
  248|      0|      }
  249|      0|    }
  250|    115|  }
  251|       |
  252|       |  /* Now update the display, row by row */
  253|    115|  bool wrap = false;
  254|  2.87k|  for ( ; frame_y < f.ds.get_height(); frame_y++ ) {
  ------------------
  |  Branch (254:11): [True: 2.76k, False: 115]
  ------------------
  255|  2.76k|    wrap = put_row( initialized, frame, f, frame_y, *rows.at( frame_y ), wrap );
  256|  2.76k|  }
  257|       |
  258|       |  /* has cursor location changed? */
  259|    115|  if ( ( !initialized ) || ( f.ds.get_cursor_row() != frame.cursor_y )
  ------------------
  |  Branch (259:8): [True: 0, False: 115]
  |  Branch (259:28): [True: 0, False: 115]
  ------------------
  260|    115|       || ( f.ds.get_cursor_col() != frame.cursor_x ) ) {
  ------------------
  |  Branch (260:11): [True: 0, False: 115]
  ------------------
  261|      0|    frame.append_move( f.ds.get_cursor_row(), f.ds.get_cursor_col() );
  262|      0|  }
  263|       |
  264|       |  /* has cursor visibility changed? */
  265|    115|  if ( ( !initialized ) || ( f.ds.cursor_visible != frame.cursor_visible ) ) {
  ------------------
  |  Branch (265:8): [True: 0, False: 115]
  |  Branch (265:28): [True: 0, False: 115]
  ------------------
  266|      0|    if ( f.ds.cursor_visible ) {
  ------------------
  |  Branch (266:10): [True: 0, False: 0]
  ------------------
  267|      0|      frame.append( "\033[?25h" );
  268|      0|    } else {
  269|      0|      frame.append( "\033[?25l" );
  270|      0|    }
  271|      0|  }
  272|       |
  273|       |  /* have renditions changed? */
  274|    115|  frame.update_rendition( f.ds.get_renditions(), !initialized );
  275|       |  /* has hyperlink changed? */
  276|    115|  frame.update_hyperlink( f.ds.get_hyperlink(), !initialized );
  277|       |
  278|       |  /* has bracketed paste mode changed? */
  279|    115|  if ( ( !initialized ) || ( f.ds.bracketed_paste != frame.last_frame.ds.bracketed_paste ) ) {
  ------------------
  |  Branch (279:8): [True: 0, False: 115]
  |  Branch (279:28): [True: 0, False: 115]
  ------------------
  280|      0|    frame.append( f.ds.bracketed_paste ? "\033[?2004h" : "\033[?2004l" );
  ------------------
  |  Branch (280:19): [True: 0, False: 0]
  ------------------
  281|      0|  }
  282|       |
  283|       |  /* has mouse reporting mode changed? */
  284|    115|  if ( ( !initialized ) || ( f.ds.mouse_reporting_mode != frame.last_frame.ds.mouse_reporting_mode ) ) {
  ------------------
  |  Branch (284:8): [True: 0, False: 115]
  |  Branch (284:28): [True: 0, False: 115]
  ------------------
  285|      0|    if ( f.ds.mouse_reporting_mode == DrawState::MOUSE_REPORTING_NONE ) {
  ------------------
  |  Branch (285:10): [True: 0, False: 0]
  ------------------
  286|      0|      frame.append( "\033[?1003l" );
  287|      0|      frame.append( "\033[?1002l" );
  288|      0|      frame.append( "\033[?1001l" );
  289|      0|      frame.append( "\033[?1000l" );
  290|      0|    } else {
  291|      0|      if ( frame.last_frame.ds.mouse_reporting_mode != DrawState::MOUSE_REPORTING_NONE ) {
  ------------------
  |  Branch (291:12): [True: 0, False: 0]
  ------------------
  292|      0|        snprintf( tmp, sizeof( tmp ), "\033[?%dl", frame.last_frame.ds.mouse_reporting_mode );
  293|      0|        frame.append( tmp );
  294|      0|      }
  295|      0|      snprintf( tmp, sizeof( tmp ), "\033[?%dh", f.ds.mouse_reporting_mode );
  296|      0|      frame.append( tmp );
  297|      0|    }
  298|      0|  }
  299|       |
  300|       |  /* has mouse focus mode changed? */
  301|    115|  if ( ( !initialized ) || ( f.ds.mouse_focus_event != frame.last_frame.ds.mouse_focus_event ) ) {
  ------------------
  |  Branch (301:8): [True: 0, False: 115]
  |  Branch (301:28): [True: 0, False: 115]
  ------------------
  302|      0|    frame.append( f.ds.mouse_focus_event ? "\033[?1004h" : "\033[?1004l" );
  ------------------
  |  Branch (302:19): [True: 0, False: 0]
  ------------------
  303|      0|  }
  304|       |
  305|       |  /* has mouse encoding mode changed? */
  306|    115|  if ( ( !initialized ) || ( f.ds.mouse_encoding_mode != frame.last_frame.ds.mouse_encoding_mode ) ) {
  ------------------
  |  Branch (306:8): [True: 0, False: 115]
  |  Branch (306:28): [True: 0, False: 115]
  ------------------
  307|      0|    if ( f.ds.mouse_encoding_mode == DrawState::MOUSE_ENCODING_DEFAULT ) {
  ------------------
  |  Branch (307:10): [True: 0, False: 0]
  ------------------
  308|      0|      frame.append( "\033[?1015l" );
  309|      0|      frame.append( "\033[?1006l" );
  310|      0|      frame.append( "\033[?1005l" );
  311|      0|    } else {
  312|      0|      if ( frame.last_frame.ds.mouse_encoding_mode != DrawState::MOUSE_ENCODING_DEFAULT ) {
  ------------------
  |  Branch (312:12): [True: 0, False: 0]
  ------------------
  313|      0|        snprintf( tmp, sizeof( tmp ), "\033[?%dl", frame.last_frame.ds.mouse_encoding_mode );
  314|      0|        frame.append( tmp );
  315|      0|      }
  316|      0|      snprintf( tmp, sizeof( tmp ), "\033[?%dh", f.ds.mouse_encoding_mode );
  317|      0|      frame.append( tmp );
  318|      0|    }
  319|      0|  }
  320|       |
  321|    115|  return frame.str;
  322|    115|}
_ZNK8Terminal7Display7put_rowEbRNS_10FrameStateERKNS_11FramebufferEiRKNS_3RowEb:
  330|  2.76k|{
  331|  2.76k|  char tmp[64];
  332|  2.76k|  int frame_x = 0;
  333|       |
  334|  2.76k|  const Row& row = *f.get_row( frame_y );
  335|  2.76k|  const Row::cells_type& cells = row.cells;
  336|  2.76k|  const Row::cells_type& old_cells = old_row.cells;
  337|       |
  338|       |  /* If we're forced to write the first column because of wrap, go ahead and do so. */
  339|  2.76k|  if ( wrap ) {
  ------------------
  |  Branch (339:8): [True: 0, False: 2.76k]
  ------------------
  340|      0|    const Cell& cell = cells.at( 0 );
  341|      0|    frame.update_rendition( cell.get_renditions() );
  342|      0|    frame.update_hyperlink( cell.get_hyperlink() );
  343|      0|    frame.append_cell( cell );
  344|      0|    frame_x += cell.get_width();
  345|      0|    frame.cursor_x += cell.get_width();
  346|      0|  }
  347|       |
  348|       |  /* If rows are the same object, we don't need to do anything at all. */
  349|  2.76k|  if ( initialized && &row == &old_row ) {
  ------------------
  |  Branch (349:8): [True: 2.76k, False: 0]
  |  Branch (349:23): [True: 0, False: 2.76k]
  ------------------
  350|      0|    return false;
  351|      0|  }
  352|       |
  353|  2.76k|  const bool wrap_this = row.get_wrap();
  354|  2.76k|  const int row_width = f.ds.get_width();
  355|  2.76k|  int clear_count = 0;
  356|  2.76k|  bool wrote_last_cell = false;
  357|  2.76k|  Renditions blank_renditions = initial_rendition();
  358|  2.76k|  Hyperlink blank_hyperlink;
  359|       |
  360|       |  /* iterate for every cell */
  361|   223k|  while ( frame_x < row_width ) {
  ------------------
  |  Branch (361:11): [True: 220k, False: 2.76k]
  ------------------
  362|       |
  363|   220k|    const Cell& cell = cells.at( frame_x );
  364|       |
  365|       |    /* Does cell need to be drawn?  Skip all this. */
  366|   220k|    if ( initialized && !clear_count && ( cell == old_cells.at( frame_x ) ) ) {
  ------------------
  |  Branch (366:10): [True: 220k, False: 0]
  |  Branch (366:25): [True: 220k, False: 0]
  |  Branch (366:41): [True: 220k, False: 0]
  ------------------
  367|   220k|      frame_x += cell.get_width();
  368|   220k|      continue;
  369|   220k|    }
  370|       |
  371|       |    /* Slurp up all the empty cells */
  372|      0|    if ( cell.empty() ) {
  ------------------
  |  Branch (372:10): [True: 0, False: 0]
  ------------------
  373|      0|      if ( !clear_count ) {
  ------------------
  |  Branch (373:12): [True: 0, False: 0]
  ------------------
  374|      0|        blank_renditions = cell.get_renditions();
  375|      0|        blank_hyperlink = cell.get_hyperlink();
  376|      0|      }
  377|      0|      if ( cell.get_renditions() == blank_renditions && cell.get_hyperlink() == blank_hyperlink ) {
  ------------------
  |  Branch (377:12): [True: 0, False: 0]
  |  Branch (377:57): [True: 0, False: 0]
  ------------------
  378|       |        /* Remember run of blank cells */
  379|      0|        clear_count++;
  380|      0|        frame_x++;
  381|      0|        continue;
  382|      0|      }
  383|      0|    }
  384|       |
  385|       |    /* Clear or write cells within the row (not to end). */
  386|      0|    if ( clear_count ) {
  ------------------
  |  Branch (386:10): [True: 0, False: 0]
  ------------------
  387|       |      /* Move to the right position. */
  388|      0|      frame.append_silent_move( frame_y, frame_x - clear_count );
  389|      0|      frame.update_rendition( blank_renditions );
  390|      0|      frame.update_hyperlink( blank_hyperlink );
  391|      0|      if ( can_use_erase( frame ) && has_ech && clear_count > 4 ) {
  ------------------
  |  Branch (391:12): [True: 0, False: 0]
  |  Branch (391:38): [True: 0, False: 0]
  |  Branch (391:49): [True: 0, False: 0]
  ------------------
  392|      0|        snprintf( tmp, 64, "\033[%dX", clear_count );
  393|      0|        frame.append( tmp );
  394|      0|      } else {
  395|      0|        frame.append( clear_count, ' ' );
  396|      0|        frame.cursor_x = frame_x;
  397|      0|      }
  398|      0|      clear_count = 0;
  399|       |      // If the current character is *another* empty cell in a different rendition,
  400|       |      // we restart counting and continue here
  401|      0|      if ( cell.empty() ) {
  ------------------
  |  Branch (401:12): [True: 0, False: 0]
  ------------------
  402|      0|        blank_renditions = cell.get_renditions();
  403|      0|        blank_hyperlink = cell.get_hyperlink();
  404|      0|        clear_count = 1;
  405|      0|        frame_x++;
  406|      0|        continue;
  407|      0|      }
  408|      0|    }
  409|       |
  410|       |    /* Now draw a character cell. */
  411|       |    /* Move to the right position. */
  412|      0|    const int cell_width = cell.get_width();
  413|       |    /* If we are about to print the last character in a wrapping row,
  414|       |       trash the cursor position to force explicit positioning.  We do
  415|       |       this because our input terminal state may have the cursor on
  416|       |       the autowrap column ("column 81"), but our output terminal
  417|       |       states always snap the cursor to the true last column ("column
  418|       |       80"), and we want to be able to apply the diff to either, for
  419|       |       verification. */
  420|      0|    if ( wrap_this && frame_x + cell_width >= row_width ) {
  ------------------
  |  Branch (420:10): [True: 0, False: 0]
  |  Branch (420:23): [True: 0, False: 0]
  ------------------
  421|      0|      frame.cursor_x = frame.cursor_y = -1;
  422|      0|    }
  423|      0|    frame.append_silent_move( frame_y, frame_x );
  424|      0|    frame.update_rendition( cell.get_renditions() );
  425|      0|    frame.update_hyperlink( cell.get_hyperlink() );
  426|      0|    frame.append_cell( cell );
  427|      0|    frame_x += cell_width;
  428|      0|    frame.cursor_x += cell_width;
  429|      0|    if ( frame_x >= row_width ) {
  ------------------
  |  Branch (429:10): [True: 0, False: 0]
  ------------------
  430|      0|      wrote_last_cell = true;
  431|      0|    }
  432|      0|  }
  433|       |
  434|       |  /* End of line. */
  435|       |
  436|       |  /* Clear or write empty cells at EOL. */
  437|  2.76k|  if ( clear_count ) {
  ------------------
  |  Branch (437:8): [True: 0, False: 2.76k]
  ------------------
  438|       |    /* Move to the right position. */
  439|      0|    frame.append_silent_move( frame_y, frame_x - clear_count );
  440|      0|    frame.update_rendition( blank_renditions );
  441|      0|    frame.update_hyperlink( blank_hyperlink );
  442|       |
  443|      0|    if ( can_use_erase( frame ) && !wrap_this ) {
  ------------------
  |  Branch (443:10): [True: 0, False: 0]
  |  Branch (443:36): [True: 0, False: 0]
  ------------------
  444|      0|      frame.append( "\033[K" );
  445|      0|    } else {
  446|      0|      frame.append( clear_count, ' ' );
  447|      0|      frame.cursor_x = frame_x;
  448|      0|      wrote_last_cell = true;
  449|      0|    }
  450|      0|  }
  451|       |
  452|  2.76k|  if ( !( wrote_last_cell && ( frame_y < f.ds.get_height() - 1 ) ) ) {
  ------------------
  |  Branch (452:11): [True: 0, False: 2.76k]
  |  Branch (452:30): [True: 0, False: 0]
  ------------------
  453|  2.76k|    return false;
  454|  2.76k|  }
  455|       |  /* To hint that a word-select should group the end of one line
  456|       |     with the beginning of the next, we let the real cursor
  457|       |     actually wrap around in cases where it wrapped around for us. */
  458|      0|  if ( wrap_this ) {
  ------------------
  |  Branch (458:8): [True: 0, False: 0]
  ------------------
  459|       |    /* Update our cursor, and ask for wrap on the next row. */
  460|      0|    frame.cursor_x = 0;
  461|      0|    frame.cursor_y++;
  462|      0|    return true;
  463|      0|  }
  464|       |  /* Resort to CR/LF and update our cursor. */
  465|      0|  frame.append( "\r\n" );
  466|      0|  frame.cursor_x = 0;
  467|      0|  frame.cursor_y++;
  468|      0|  return false;
  469|      0|}
_ZN8Terminal10FrameStateC2ERKNS_11FramebufferE:
  477|    115|  : str(), cursor_x( 0 ), cursor_y( 0 ), current_rendition( 0 ), current_hyperlink(),
  478|    115|    cursor_visible( s_last.ds.cursor_visible ), last_frame( s_last )
  479|    115|{
  480|       |  /* Preallocate for better performance.  Make a guess-- doesn't matter for correctness */
  481|    115|  str.reserve( last_frame.ds.get_width() * last_frame.ds.get_height() * 4 );
  482|    115|}
_ZN8Terminal10FrameState16update_renditionERKNS_10RenditionsEb:
  525|    115|{
  526|    115|  if ( force || !( current_rendition == r ) ) {
  ------------------
  |  Branch (526:8): [True: 0, False: 115]
  |  Branch (526:17): [True: 0, False: 115]
  ------------------
  527|       |    /* print renditions */
  528|      0|    append_string( r.sgr() );
  529|      0|    current_rendition = r;
  530|      0|  }
  531|    115|}
_ZN8Terminal10FrameState16update_hyperlinkERKNS_9HyperlinkEb:
  534|    115|{
  535|    115|  if ( force || current_hyperlink != h ) {
  ------------------
  |  Branch (535:8): [True: 0, False: 115]
  |  Branch (535:17): [True: 0, False: 115]
  ------------------
  536|       |    /* print hyperlink */
  537|      0|    append_string( h.osc8() );
  538|      0|    current_hyperlink = h;
  539|      0|  }
  540|    115|}
terminaldisplay.cc:_ZL17initial_renditionv:
   43|  2.76k|{
   44|  2.76k|  const static Renditions blank = Renditions( 0 );
   45|  2.76k|  return blank;
   46|  2.76k|}

_ZN8Terminal7DisplayC2Eb:
   84|    230|  : has_ech( true ), has_bce( true ), has_title( true ), smcup( NULL ), rmcup( NULL )
   85|    230|{
   86|    230|  if ( use_environment ) {
  ------------------
  |  Branch (86:8): [True: 0, False: 230]
  ------------------
   87|      0|    int errret = -2;
   88|      0|    int ret = setupterm( (char*)0, 1, &errret );
   89|       |
   90|      0|    if ( ret != OK ) {
  ------------------
  |  Branch (90:10): [True: 0, False: 0]
  ------------------
   91|      0|      switch ( errret ) {
   92|      0|        case 1:
  ------------------
  |  Branch (92:9): [True: 0, False: 0]
  ------------------
   93|      0|          throw std::runtime_error( "Terminal is hardcopy and cannot be used by curses applications." );
   94|      0|          break;
   95|      0|        case 0:
  ------------------
  |  Branch (95:9): [True: 0, False: 0]
  ------------------
   96|      0|          throw std::runtime_error( "Unknown terminal type." );
   97|      0|          break;
   98|      0|        case -1:
  ------------------
  |  Branch (98:9): [True: 0, False: 0]
  ------------------
   99|      0|          throw std::runtime_error( "Terminfo database could not be found." );
  100|      0|          break;
  101|      0|        default:
  ------------------
  |  Branch (101:9): [True: 0, False: 0]
  ------------------
  102|      0|          throw std::runtime_error( "Unknown terminfo error." );
  103|      0|          break;
  104|      0|      }
  105|      0|    }
  106|       |
  107|       |    /* check for ECH */
  108|      0|    has_ech = ti_str( "ech" );
  109|       |
  110|       |    /* check for BCE */
  111|      0|    has_bce = ti_flag( "bce" );
  112|       |
  113|       |    /* Check if we can set the window title and icon name.  terminfo does not
  114|       |       have reliable information on this, so we hardcode a whitelist of
  115|       |       terminal type prefixes. */
  116|      0|    static const char* const title_term_types[]
  117|      0|      = { "xterm", "rxvt", "kterm", "Eterm", "alacritty", "screen", "tmux" };
  118|       |
  119|      0|    has_title = false;
  120|      0|    const char* term_type = getenv( "TERM" );
  121|      0|    if ( term_type ) {
  ------------------
  |  Branch (121:10): [True: 0, False: 0]
  ------------------
  122|      0|      for ( size_t i = 0; i < sizeof( title_term_types ) / sizeof( const char* ); i++ ) {
  ------------------
  |  Branch (122:27): [True: 0, False: 0]
  ------------------
  123|      0|        if ( 0 == strncmp( term_type, title_term_types[i], strlen( title_term_types[i] ) ) ) {
  ------------------
  |  Branch (123:14): [True: 0, False: 0]
  ------------------
  124|      0|          has_title = true;
  125|      0|          break;
  126|      0|        }
  127|      0|      }
  128|      0|    }
  129|       |
  130|      0|    if ( !getenv( "MOSH_NO_TERM_INIT" ) ) {
  ------------------
  |  Branch (130:10): [True: 0, False: 0]
  ------------------
  131|      0|      smcup = ti_str( "smcup" );
  132|      0|      rmcup = ti_str( "rmcup" );
  133|      0|    }
  134|      0|  }
  135|    230|}

_ZN8Terminal4CellC2Ej:
   42|    230|  : contents(), renditions( background_color ), hyperlink(), wide( false ), fallback( false ), wrap( false )
   43|    230|{}
_ZN8Terminal9DrawState17reinitialize_tabsEj:
   56|    230|{
   57|    230|  assert( default_tabs );
  ------------------
  |  Branch (57:3): [True: 230, False: 0]
  ------------------
   58|  18.6k|  for ( unsigned int i = start; i < tabs.size(); i++ ) {
  ------------------
  |  Branch (58:33): [True: 18.4k, False: 230]
  ------------------
   59|  18.4k|    tabs[i] = ( ( i % 8 ) == 0 );
   60|  18.4k|  }
   61|    230|}
_ZN8Terminal9DrawStateC2Eii:
   64|    230|  : width( s_width ), height( s_height ), cursor_col( 0 ), cursor_row( 0 ), combining_char_col( 0 ),
   65|    230|    combining_char_row( 0 ), default_tabs( true ), tabs( s_width ), scrolling_region_top_row( 0 ),
   66|    230|    scrolling_region_bottom_row( height - 1 ), renditions( 0 ), hyperlink(), save(), next_print_will_wrap( false ),
   67|    230|    origin_mode( false ), auto_wrap_mode( true ), insert_mode( false ), cursor_visible( true ),
   68|    230|    reverse_video( false ), bracketed_paste( false ), mouse_reporting_mode( MOUSE_REPORTING_NONE ),
   69|    230|    mouse_focus_event( false ), mouse_alternate_scroll( false ), mouse_encoding_mode( MOUSE_ENCODING_DEFAULT ),
   70|    230|    application_mode_cursor_keys( false )
   71|    230|{
   72|    230|  reinitialize_tabs( 0 );
   73|    230|}
_ZN8Terminal11FramebufferC2Eii:
   76|    230|  : rows(), icon_name(), window_title(), clipboard(), bell_count( 0 ), title_initialized( false ),
   77|    230|    ds( s_width, s_height )
   78|    230|{
   79|    230|  assert( s_height > 0 );
  ------------------
  |  Branch (79:3): [True: 230, False: 0]
  ------------------
   80|    230|  assert( s_width > 0 );
  ------------------
  |  Branch (80:3): [True: 230, False: 0]
  ------------------
   81|    230|  const size_t w = s_width;
   82|    230|  const color_type c = 0;
   83|    230|  rows = rows_type( s_height, row_pointer( std::make_shared<Row>( w, c ) ) );
   84|    230|}
_ZN8Terminal11SavedCursorC2Ev:
  281|    230|  : cursor_col( 0 ), cursor_row( 0 ), renditions( 0 ), auto_wrap_mode( true ), origin_mode( false )
  282|    230|{}
_ZN8Terminal3RowC2Emj:
  353|    230|  : cells( s_width, Cell( background_color ) ), gen( get_gen() )
  354|    230|{}
_ZNK8Terminal3Row7get_genEv:
  357|    230|{
  358|    230|  static uint64_t gen_counter = 0;
  359|    230|  return gen_counter++;
  360|    230|}
_ZN8Terminal10RenditionsC2Ej:
  458|    806|  : foreground_color( 0 ), background_color( s_background ), attributes( 0 )
  459|    806|{}
_ZNK8Terminal9HyperlinkeqERKS0_:
  608|   220k|{
  609|   220k|  if ( rep == x.rep ) {
  ------------------
  |  Branch (609:8): [True: 220k, False: 0]
  ------------------
  610|   220k|    return true;
  611|   220k|  }
  612|      0|  if ( rep == nullptr || x.rep == nullptr ) {
  ------------------
  |  Branch (612:8): [True: 0, False: 0]
  |  Branch (612:26): [True: 0, False: 0]
  ------------------
  613|      0|    return false;
  614|      0|  }
  615|       |
  616|      0|  return rep->url == x.rep->url && rep->params == x.rep->params;
  ------------------
  |  Branch (616:10): [True: 0, False: 0]
  |  Branch (616:36): [True: 0, False: 0]
  ------------------
  617|      0|}

_ZNK8Terminal10RenditionseqERKS0_:
   90|   220k|  {
   91|   220k|    return ( attributes == x.attributes ) && ( foreground_color == x.foreground_color )
  ------------------
  |  Branch (91:12): [True: 220k, False: 0]
  |  Branch (91:46): [True: 220k, False: 0]
  ------------------
   92|   220k|           && ( background_color == x.background_color );
  ------------------
  |  Branch (92:15): [True: 220k, False: 0]
  ------------------
   93|   220k|  }
_ZN8Terminal9HyperlinkC2Ev:
  105|  3.33k|  Hyperlink() : rep( nullptr ) {}
_ZNK8Terminal9HyperlinkneERKS0_:
  117|    115|  bool operator!=( const Hyperlink& x ) const { return !operator==( x ); }
_ZNK8Terminal4CelleqERKS0_:
  148|   220k|  {
  149|   220k|    return ( ( contents == x.contents ) && ( fallback == x.fallback ) && ( wide == x.wide )
  ------------------
  |  Branch (149:14): [True: 220k, False: 0]
  |  Branch (149:44): [True: 220k, False: 0]
  |  Branch (149:74): [True: 220k, False: 0]
  ------------------
  150|   220k|             && ( renditions == x.renditions ) && ( hyperlink == x.hyperlink ) && ( wrap == x.wrap ) );
  ------------------
  |  Branch (150:17): [True: 220k, False: 0]
  |  Branch (150:51): [True: 220k, False: 0]
  |  Branch (150:83): [True: 220k, False: 0]
  ------------------
  151|   220k|  }
_ZNK8Terminal4Cell9get_widthEv:
  236|   220k|  unsigned int get_width( void ) const { return wide + 1; }
_ZNK8Terminal4Cell8get_wrapEv:
  239|  2.76k|  bool get_wrap( void ) const { return wrap; }
_ZNK8Terminal3RoweqERKS0_:
  264|  2.76k|  bool operator==( const Row& x ) const { return ( gen == x.gen && cells == x.cells ); }
  ------------------
  |  Branch (264:52): [True: 0, False: 2.76k]
  |  Branch (264:68): [True: 0, False: 0]
  ------------------
_ZNK8Terminal3Row8get_wrapEv:
  266|  2.76k|  bool get_wrap( void ) const { return cells.back().get_wrap(); }
_ZNK8Terminal9DrawState14get_cursor_colEv:
  345|    230|  int get_cursor_col( void ) const { return cursor_col; }
_ZNK8Terminal9DrawState14get_cursor_rowEv:
  346|    230|  int get_cursor_row( void ) const { return cursor_row; }
_ZNK8Terminal9DrawState9get_widthEv:
  349|  3.33k|  int get_width( void ) const { return width; }
_ZNK8Terminal9DrawState10get_heightEv:
  350|  6.21k|  int get_height( void ) const { return height; }
_ZNK8Terminal9DrawState13get_hyperlinkEv:
  366|    230|  const Hyperlink& get_hyperlink() const { return hyperlink; }
_ZNK8Terminal9DrawState14get_renditionsEv:
  372|    230|  const Renditions& get_renditions( void ) const { return renditions; }
_ZNK8Terminal11Framebuffer8get_rowsEv:
  436|    115|  const rows_type& get_rows() const { return rows; }
_ZNK8Terminal11Framebuffer7get_rowEi:
  442|  5.52k|  {
  443|  5.52k|    if ( row == -1 )
  ------------------
  |  Branch (443:10): [True: 0, False: 5.52k]
  ------------------
  444|      0|      row = ds.get_cursor_row();
  445|       |
  446|  5.52k|    return rows.at( row ).get();
  447|  5.52k|  }
_ZNK8Terminal11Framebuffer20is_title_initializedEv:
  497|    115|  bool is_title_initialized( void ) const { return title_initialized; }
_ZNK8Terminal11Framebuffer13get_clipboardEv:
  503|    230|  const title_type& get_clipboard( void ) const { return clipboard; }
_ZNK8Terminal11Framebuffer14get_bell_countEv:
  513|    230|  unsigned int get_bell_count( void ) const { return bell_count; }

_ZN8Terminal9UserInput5inputB5cxx11EPKN6Parser8UserByteEb:
   40|  4.19M|{
   41|       |  /* The user will always be in application mode. If stm is not in
   42|       |     application mode, convert user's cursor control function to an
   43|       |     ANSI cursor control sequence */
   44|       |
   45|       |  /* We need to look ahead one byte in the SS3 state to see if
   46|       |     the next byte will be A, B, C, or D (cursor control keys). */
   47|       |
   48|       |  /* This doesn't handle the 8-bit SS3 C1 control, which would be
   49|       |     two octets in UTF-8. Fortunately nobody seems to send this. */
   50|       |
   51|  4.19M|  switch ( state ) {
   52|  4.17M|    case Ground:
  ------------------
  |  Branch (52:5): [True: 4.17M, False: 25.2k]
  ------------------
   53|  4.17M|      if ( act->c == 0x1b ) { /* ESC */
  ------------------
  |  Branch (53:12): [True: 16.2k, False: 4.15M]
  ------------------
   54|  16.2k|        state = ESC;
   55|  16.2k|      }
   56|  4.17M|      return std::string( &act->c, 1 );
   57|       |
   58|  16.2k|    case ESC:
  ------------------
  |  Branch (58:5): [True: 16.2k, False: 4.18M]
  ------------------
   59|  16.2k|      if ( act->c == 'O' ) { /* ESC O = 7-bit SS3 */
  ------------------
  |  Branch (59:12): [True: 8.99k, False: 7.29k]
  ------------------
   60|  8.99k|        state = SS3;
   61|  8.99k|        return std::string();
   62|  8.99k|      }
   63|  7.29k|      state = Ground;
   64|  7.29k|      return std::string( &act->c, 1 );
   65|       |
   66|  8.99k|    case SS3:
  ------------------
  |  Branch (66:5): [True: 8.99k, False: 4.18M]
  ------------------
   67|  8.99k|      state = Ground;
   68|  8.99k|      if ( ( !application_mode_cursor_keys ) && ( act->c >= 'A' ) && ( act->c <= 'D' ) ) {
  ------------------
  |  Branch (68:12): [True: 8.99k, False: 0]
  |  Branch (68:49): [True: 5.74k, False: 3.24k]
  |  Branch (68:70): [True: 446, False: 5.29k]
  ------------------
   69|    446|        char translated_cursor[2] = { '[', act->c };
   70|    446|        return std::string( translated_cursor, 2 );
   71|  8.54k|      } else {
   72|  8.54k|        char original_cursor[2] = { 'O', act->c };
   73|  8.54k|        return std::string( original_cursor, 2 );
   74|  8.54k|      }
   75|       |
   76|      0|    default:
  ------------------
  |  Branch (76:5): [True: 0, False: 4.19M]
  ------------------
   77|      0|      assert( !"unexpected state" );
  ------------------
  |  Branch (77:7): [Folded, False: 0]
  ------------------
   78|      0|      state = Ground;
   79|      0|      return std::string();
   80|  4.19M|  }
   81|  4.19M|}

_ZN8Terminal9UserInputC2Ev:
   54|    115|  UserInput() : state( Ground ) {}

