Input-driven case-sensivity of search

This commit is contained in:
Sebastian Gniazdowski 2017-01-27 13:08:52 +01:00
parent b0f9de1bb6
commit 82e639c11e
2 changed files with 10 additions and 3 deletions

View file

@ -14,6 +14,9 @@ HSMW is **FAST** highlighting 20 concurrent complex history entries does not
# News
* 27-01-2017
- Input-driven case-sensivity of search  if your query contains capital latin letters, search will be case-sensitive
* 12-11-2016
- HSMW can now show context of selected history entry! Just hit `Ctrl-K`, [video](https://asciinema.org/a/92516)
- More performance optimizations

View file

@ -96,9 +96,13 @@ _hsmw_main() {
if [[ "${#__hsmw_hcw_found[@]}" -eq "0" ]]; then
# The repeat will make the matching work on a fresh heap arena
repeat 1; do
# Tip: these are equal:
#__hsmw_hcw_found=( "${(@M)history:#(#i)*$~search_pattern*}" )
[[ -z "$search_pattern" ]] && __hsmw_hcw_found=( ${(@)history} ) || __hsmw_hcw_found=( "${(@)history[(R)(#i)*$~search_pattern*]}" )
if [[ "$search_pattern" != *[A-Z]* ]]; then
# Tip: these are equal:
#__hsmw_hcw_found=( "${(@M)history:#(#i)*$~search_pattern*}" )
[[ -z "$search_pattern" ]] && __hsmw_hcw_found=( ${(@)history} ) || __hsmw_hcw_found=( "${(@)history[(R)(#i)*$~search_pattern*]}" )
else
__hsmw_hcw_found=( "${(@)history[(R)*$~search_pattern*]}" )
fi
done
fi