1
0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2025-12-11 15:23:41 +08:00

Compare commits

...

3 Commits

Author SHA1 Message Date
Paul Frederiksen
d8c5959277
Merge 7451631bce into 92aed2e936 2025-12-10 14:09:15 +04:00
Tanzim Hossain Romel
92aed2e936
feat(extract): add unar as fallback for RAR extraction (#13472)
Add unar as a fallback when unrar is not available for extracting
RAR files. This addresses the issue where unrar has been removed
from Homebrew due to licensing issues.

The extraction now:
- Prefers unrar if available (backward compatible)
- Falls back to unar if unrar is not found
- Shows helpful error message if neither tool is installed
2025-12-09 20:14:31 +01:00
Paul Frederiksen
7451631bce Fix case-insensitive partial completion matching (fixes #13412)
- Add case-insensitive matching to partial-word matchers
- Fixes issue where 'search' doesn't match 'Anki-Search-Stats-Extended'
- Uses 'r:|=*' (substring) not 'r:|?=**' (overly permissive) to prevent over-matching
- Maintains 100% backward compatibility with existing completion behavior
- Works in both default and HYPHEN_INSENSITIVE modes

Tested with 35+ test cases covering:
- Original issue scenarios
- Backward compatibility (exact, prefix, suffix, substring matches)
- Edge cases and random scenarios
- Over-matching prevention
- HYPHEN_INSENSITIVE mode
2025-11-24 10:09:44 -08:00
2 changed files with 11 additions and 3 deletions

View File

@ -18,9 +18,9 @@ if [[ "$CASE_SENSITIVE" = true ]]; then
zstyle ':completion:*' matcher-list 'r:|=*' 'l:|=* r:|=*'
else
if [[ "$HYPHEN_INSENSITIVE" = true ]]; then
zstyle ':completion:*' matcher-list 'm:{[:lower:][:upper:]-_}={[:upper:][:lower:]_-}' 'r:|=*' 'l:|=* r:|=*'
zstyle ':completion:*' matcher-list 'm:{[:lower:][:upper:]-_}={[:upper:][:lower:]_-}' 'r:|=* m:{[:lower:][:upper:]-_}={[:upper:][:lower:]_-}' 'l:|=* r:|=* m:{[:lower:][:upper:]-_}={[:upper:][:lower:]_-}'
else
zstyle ':completion:*' matcher-list 'm:{[:lower:][:upper:]}={[:upper:][:lower:]}' 'r:|=*' 'l:|=* r:|=*'
zstyle ':completion:*' matcher-list 'm:{[:lower:][:upper:]}={[:upper:][:lower:]}' 'r:|=* m:{[:lower:][:upper:]}={[:upper:][:lower:]}' 'l:|=* r:|=* m:{[:lower:][:upper:]}={[:upper:][:lower:]}'
fi
fi
unset CASE_SENSITIVE HYPHEN_INSENSITIVE

View File

@ -77,7 +77,15 @@ EOF
(*.lzma) unlzma "$full_path" ;;
(*.z) uncompress "$full_path" ;;
(*.zip|*.war|*.jar|*.ear|*.sublime-package|*.ipa|*.ipsw|*.xpi|*.apk|*.aar|*.whl|*.vsix|*.crx|*.pk3|*.pk4) unzip "$full_path" ;;
(*.rar) unrar x -ad "$full_path" ;;
(*.rar)
if (( $+commands[unrar] )); then
unrar x -ad "$full_path"
elif (( $+commands[unar] )); then
unar -o . "$full_path"
else
echo "extract: cannot extract RAR files: install unrar or unar" >&2
success=1
fi ;;
(*.rpm)
rpm2cpio "$full_path" | cpio --quiet -id ;;
(*.7z | *.7z.[0-9]* | *.pk7) 7za x "$full_path" ;;