diff options
| -rw-r--r-- | lisp/icomplete.el | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/lisp/icomplete.el b/lisp/icomplete.el index 40f4f0bc688..a7f9086d828 100644 --- a/lisp/icomplete.el +++ b/lisp/icomplete.el | |||
| @@ -572,6 +572,13 @@ matches exist." | |||
| 572 | (compare (compare-strings name nil nil | 572 | (compare (compare-strings name nil nil |
| 573 | most nil nil completion-ignore-case)) | 573 | most nil nil completion-ignore-case)) |
| 574 | (ellipsis (if (char-displayable-p ?…) "…" "...")) | 574 | (ellipsis (if (char-displayable-p ?…) "…" "...")) |
| 575 | ;; `determ' is what we "determined" to be the thing that | ||
| 576 | ;; TAB will complete to. Also, if we're working with a | ||
| 577 | ;; large prefix (like when finding files), we want to | ||
| 578 | ;; truncate the common prefix away. `determ-ellipsis' | ||
| 579 | ;; says if we should do it with an `ellipsis'. Icomplete | ||
| 580 | ;; uses one, Ido doesn't. | ||
| 581 | (determ-ellipsis (if fido-mode "" ellipsis)) | ||
| 575 | (determ (unless (or (eq t compare) (eq t most-try) | 582 | (determ (unless (or (eq t compare) (eq t most-try) |
| 576 | (= (setq compare (1- (abs compare))) | 583 | (= (setq compare (1- (abs compare))) |
| 577 | (length most))) | 584 | (length most))) |
| @@ -582,8 +589,10 @@ matches exist." | |||
| 582 | (substring most compare)) | 589 | (substring most compare)) |
| 583 | ;; Don't bother truncating if it doesn't gain | 590 | ;; Don't bother truncating if it doesn't gain |
| 584 | ;; us at least 2 columns. | 591 | ;; us at least 2 columns. |
| 585 | ((< compare (+ 2 (string-width ellipsis))) most) | 592 | ((< compare (+ 2 (string-width determ-ellipsis))) |
| 586 | (t (concat ellipsis (substring most compare)))) | 593 | most) |
| 594 | (t (concat determ-ellipsis | ||
| 595 | (substring most compare)))) | ||
| 587 | close-bracket))) | 596 | close-bracket))) |
| 588 | ;;"-prospects" - more than one candidate | 597 | ;;"-prospects" - more than one candidate |
| 589 | (prospects-len (+ (string-width | 598 | (prospects-len (+ (string-width |
| @@ -664,6 +673,8 @@ matches exist." | |||
| 664 | (mapconcat 'identity prospects icomplete-separator) | 673 | (mapconcat 'identity prospects icomplete-separator) |
| 665 | (and limit (concat icomplete-separator ellipsis)) | 674 | (and limit (concat icomplete-separator ellipsis)) |
| 666 | "}") | 675 | "}") |
| 676 | (put-text-property 1 (1- (length determ)) | ||
| 677 | 'face 'icomplete-first-match determ) | ||
| 667 | (concat determ " [Matched]")))))) | 678 | (concat determ " [Matched]")))))) |
| 668 | 679 | ||
| 669 | ;;; Iswitchb compatibility | 680 | ;;; Iswitchb compatibility |