@@ -234,6 +234,10 @@ module readline |
| 234 | 234 | ! Module-level editing mode (set by shell via option_vi) |
| 235 | 235 | integer, save :: global_editing_mode = EDITING_MODE_EMACS |
| 236 | 236 | |
| 237 | + ! Fuzzy completion: off by default (prefix-only like bash/zsh) |
| 238 | + ! Enable with: set -o fuzzy-complete |
| 239 | + logical, save :: global_fuzzy_complete = .false. |
| 240 | + |
| 237 | 241 | ! Detect macOS for potential platform-specific workarounds |
| 238 | 242 | logical, save :: is_macos_system = .false. |
| 239 | 243 | logical, save :: macos_detected = .false. |
@@ -907,6 +911,11 @@ contains |
| 907 | 911 | end if |
| 908 | 912 | end subroutine |
| 909 | 913 | |
| 914 | + subroutine set_global_fuzzy_complete(enabled) |
| 915 | + logical, intent(in) :: enabled |
| 916 | + global_fuzzy_complete = enabled |
| 917 | + end subroutine |
| 918 | + |
| 910 | 919 | ! Check if we're on macOS (called once at startup) |
| 911 | 920 | subroutine detect_macos() |
| 912 | 921 | character(len=256) :: sysname |
@@ -6290,10 +6299,11 @@ contains |
| 6290 | 6299 | return |
| 6291 | 6300 | end if |
| 6292 | 6301 | |
| 6293 | | - ! For short patterns (1-3 chars), require prefix match for better UX |
| 6294 | | - ! This prevents "RE" from matching "parser_enhanced.mod" |
| 6295 | | - ! and "tes" from matching "ast_types.mod" |
| 6296 | | - if (pattern_len <= 3) then |
| 6302 | + ! Require prefix match unless fuzzy-complete is enabled. |
| 6303 | + ! With fuzzy off (default): behaves like bash/zsh — only prefix matches. |
| 6304 | + ! With fuzzy on (set -o fuzzy-complete): short patterns still require |
| 6305 | + ! prefix, longer patterns allow fuzzy subsequence matching. |
| 6306 | + if (.not. global_fuzzy_complete .or. pattern_len <= 3) then |
| 6297 | 6307 | is_prefix_match = .true. |
| 6298 | 6308 | do i = 1, pattern_len |
| 6299 | 6309 | if (to_lowercase(pattern(i:i)) /= to_lowercase(candidate(i:i))) then |