# File lib/rbreadline.rb, line 8086
  def noninc_dosearch(string, dir)
    if (string.nil? || string == '' || @noninc_history_pos < 0)
      rl_ding()
      return 0
    end

    pos = noninc_search_from_pos(string, @noninc_history_pos + dir, dir)
    if (pos == -1)
      # Search failed, current history position unchanged.
      rl_maybe_unsave_line()
      rl_clear_message()
      @rl_point = 0
      rl_ding()
      return 0
    end

    @noninc_history_pos = pos

    oldpos = where_history()
    history_set_pos(@noninc_history_pos)
    entry = current_history()
    if (@rl_editing_mode != @vi_mode)
      history_set_pos(oldpos)
    end
    make_history_line_current(entry)
    @rl_point = 0
    @rl_mark = @rl_end
    rl_clear_message()
    1
  end