[gnome-builder] completion: add additional cost to mismatched casing



commit a4b6254206be9cef5855461b6b8477f6999d43cc
Author: Christian Hergert <chergert redhat com>
Date:   Thu Oct 25 11:58:37 2018 -0700

    completion: add additional cost to mismatched casing
    
    If we match 'E' with 'e', that should have a higher cost than 'e' with 'e'.

 src/libide/completion/ide-completion.c | 4 ++++
 1 file changed, 4 insertions(+)
---
diff --git a/src/libide/completion/ide-completion.c b/src/libide/completion/ide-completion.c
index 42172880b..1d3c296b8 100644
--- a/src/libide/completion/ide-completion.c
+++ b/src/libide/completion/ide-completion.c
@@ -1702,6 +1702,10 @@ ide_completion_fuzzy_match (const gchar *haystack,
        */
       real_score += (tmp - haystack) * 2;
 
+      /* Add extra cost if we matched by using toupper */
+      if (*haystack == chup)
+        real_score += 1;
+
       /*
        * Now move past our matching character so we cannot match
        * it a second time.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]