about summary refs log tree commit diff
path: root/src/nix
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2018-09-24T11·03+0200
committerGitHub <noreply@github.com>2018-09-24T11·03+0200
commit42e4ea2b6dee6581a1f5e2a82e902eb8f1d83940 (patch)
tree51d54ec5805e7aa030f11338e8ed5e8948a658d6 /src/nix
parenta48c2e3411298279b65cab69d1f40bc4fb6c1c94 (diff)
parent0d72f4e0ca3e88f3ded66112a6b157e14c2724c4 (diff)
Merge pull request #2312 from dtzWill/fix/matched-names-should-still-print-version
search: include version for matches too!
Diffstat (limited to 'src/nix')
-rw-r--r--src/nix/search.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/nix/search.cc b/src/nix/search.cc
index 4cb1efa7955b..e086de2260a6 100644
--- a/src/nix/search.cc
+++ b/src/nix/search.cc
@@ -173,10 +173,12 @@ struct CmdSearch : SourceExprCommand, MixJSON
                             jsonElem.attr("description", description);
 
                         } else {
+                            auto name = hilite(parsed.name, nameMatch, "\e[0;2m")
+                                + std::string(parsed.fullName, parsed.name.length());
                             results[attrPath] = fmt(
                                 "* %s (%s)\n  %s\n",
                                 wrap("\e[0;1m", hilite(attrPath, attrPathMatch, "\e[0;1m")),
-                                wrap("\e[0;2m", hilite(parsed.fullName, nameMatch, "\e[0;2m")),
+                                wrap("\e[0;2m", hilite(name, nameMatch, "\e[0;2m")),
                                 hilite(description, descriptionMatch, ANSI_NORMAL));
                         }
                     }