diff options
author | Colin Watson <cjwatson@debian.org> | 2022-10-18 01:13:59 +0100 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2022-10-18 01:13:59 +0100 |
commit | 5d812783140774017815a8b173aa80ae6d851f37 (patch) | |
tree | e2f1d75a2f3610a7ab7ccb4af3100592b660c837 | |
parent | 20f048d1b4303158f61d7e88330f6c5b53a82b81 (diff) |
Sort whatis references below real pages more aggressively
I think this makes more sense in most cases, and it definitely fixes
some observed odd behaviour.
Fixes Debian bug #780235.
* src/man.c (compare_candidates): Compare IDs before comparing sections.
* NEWS.md: Document this.
-rw-r--r-- | NEWS.md | 2 | ||||
-rw-r--r-- | src/man.c | 19 |
2 files changed, 11 insertions, 10 deletions
@@ -7,6 +7,8 @@ Fixes: prompts. Note that this requires `less` >= 457 (released in 2012). * Silence error message when processing an empty manual page hierarchy with a nonexistent cache directory. + * `man(1)` now sorts whatis references below real pages, even if the whatis + references are from a section with higher priority. Improvements: @@ -2792,11 +2792,15 @@ static int compare_candidates (const struct candidate *left, return 1; } - /* Compare pure sections first, then ids, then extensions. - * Rationale: whatis refs get the same section and extension as - * their source, but may be supplanted by a real page with a - * slightly different extension, possibly in another hierarchy (!); - * see Debian bug #204249 for the gory details. + /* ULT_MAN comes first, etc. Consider SO_MAN equivalent to ULT_MAN. + * This has the effect of sorting mere whatis references below real + * pages. + */ + cmp = compare_ids (lsource->id, rsource->id, true); + if (cmp) + return cmp; + + /* Compare pure sections first, then extensions. * * Any extension spelt out in full in section_list effectively * becomes a pure section; this allows extensions to be selectively @@ -2849,11 +2853,6 @@ static int compare_candidates (const struct candidate *left, return cmp; } - /* ULT_MAN comes first, etc. Consider SO_MAN equivalent to ULT_MAN. */ - cmp = compare_ids (lsource->id, rsource->id, true); - if (cmp) - return cmp; - /* The order in section_list has already been compared above. For * everything not mentioned explicitly there, we just compare * lexically. |