# File lib/rbreadline.rb, line 8062
  def noninc_search_from_pos(string, pos, dir)
    return 1 if (pos < 0)

    old = where_history()
    return -1 if (history_set_pos(pos) == 0)

    rl_setstate(RL_STATE_SEARCH)
    if (string[0,1] == '^')
      ret = history_search_prefix(string + 1, dir)
    else
      ret = history_search(string, dir)
    end
    rl_unsetstate(RL_STATE_SEARCH)

    if (ret != -1)
      ret = where_history()
    end
    history_set_pos(old)
    ret
  end