@@ -24,7 +24,7 @@ const FILTER_SEPARATOR = ';'
2424
2525List of single-character prefixes that set search modes.
2626"""
27- const FILTER_PREFIXES = (' !' , ' `' , ' =' , ' /' , ' ~' , ' > ' )
27+ const FILTER_PREFIXES = (' !' , ' `' , ' =' , ' /' , ' ~' )
2828
2929"""
3030 FILTER_SHORTHELP_QUERY
@@ -53,20 +53,22 @@ const FILTER_SHORTHELP = S"""
5353
5454 See more information on behaviour and keybindings with '{REPL_History_search_prefix:??}'.
5555
56+ By default, each word in the search string is looked for in any order.
57+ Should the search string start with {REPL_History_search_prefix:xyz>}, then only xyz-mode entries are considered.
58+
5659 Different search modes are available via prefixes, as follows:
5760 {emphasis:•} {REPL_History_search_prefix:=} looks for exact matches
5861 {emphasis:•} {REPL_History_search_prefix:!} {italic:excludes} exact matches
5962 {emphasis:•} {REPL_History_search_prefix:/} performs a regexp search
6063 {emphasis:•} {REPL_History_search_prefix:~} looks for fuzzy matches
61- {emphasis:•} {REPL_History_search_prefix:>} looks for a particular REPL mode
6264 {emphasis:•} {REPL_History_search_prefix:`} looks for an initialism (text with matching initials)
6365
6466 You can also apply multiple restrictions with the separator '{REPL_History_search_separator:$FILTER_SEPARATOR}'.
6567
6668 For example, {region:{REPL_History_search_prefix:/}^foo{REPL_History_search_separator:$FILTER_SEPARATOR}\
6769{REPL_History_search_prefix:`}bar{REPL_History_search_separator:$FILTER_SEPARATOR}\
68- {REPL_History_search_prefix:>}shell } will look for history entries that start with "{code:foo}",
69- contains "{code:b... a... r...}", {italic:and} is a shell history entry.
70+ {REPL_History_search_prefix:shell>} } will look for history entries that start with "{code:foo}",
71+ contains "{code:b... a... r...}", {italic:and} are a shell history entry.
7072"""
7173
7274const FILTER_LONGHELP = S """
@@ -108,9 +110,9 @@ function ConditionSet(spec::S) where {S <: AbstractString}
108110 function addcond! (condset:: ConditionSet , cond:: SubString )
109111 isempty (cond) && return
110112 kind = first (cond)
111- if kind ∈ (' !' , ' =' , ' `' , ' /' , ' > ' , ' ~' )
113+ if kind ∈ (' !' , ' =' , ' `' , ' /' , ' ~' )
112114 value = @view cond[2 : end ]
113- if kind ∈ (' `' , ' > ' , ' ~' )
115+ if kind ∈ (' `' , ' ~' )
114116 value = strip (value)
115117 elseif ! all (isspace, value)
116118 value = if kind == ' /'
@@ -128,16 +130,23 @@ function ConditionSet(spec::S) where {S <: AbstractString}
128130 push! (condset. initialisms, value)
129131 elseif startswith (cond, ' /' )
130132 push! (condset. regexps, value)
131- elseif startswith (cond, ' >' )
132- push! (condset. modes, SubString (lowercase (value)))
133133 elseif startswith (cond, ' ~' )
134134 push! (condset. fuzzy, value)
135135 end
136136 else
137137 if startswith (cond, ' \\ ' ) && ! (length (cond) > 1 && cond[2 ] == ' \\ ' )
138138 cond = @view cond[2 : end ]
139+ else
140+ rang = something (findfirst (' >' , cond), typemax (Int))
141+ if rang == something (findfirst (isspace, cond), ncodeunits (cond) + 1 ) - 1
142+ mode = @view cond[1 : prevind (cond, rang)]
143+ push! (condset. modes, SubString (lowercase (mode)))
144+ cond = @view cond[rang + 1 : end ]
145+ end
139146 end
140- push! (condset. words, strip (cond))
147+ cond = strip (cond)
148+ isempty (cond) && return
149+ push! (condset. words, cond)
141150 end
142151 nothing
143152 end
0 commit comments