From c1634ae457defe3cf148939cc4a00774ee9f5d1a Mon Sep 17 00:00:00 2001 From: leo Date: Wed, 25 Feb 2026 11:52:16 +0800 Subject: [PATCH] feature: keyword in commit subject can end with `-` character Signed-off-by: leo --- src/Views/CommitSubjectPresenter.cs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/Views/CommitSubjectPresenter.cs b/src/Views/CommitSubjectPresenter.cs index be2085af..bbf33b35 100644 --- a/src/Views/CommitSubjectPresenter.cs +++ b/src/Views/CommitSubjectPresenter.cs @@ -256,9 +256,19 @@ namespace SourceGit.Views } else { - var colonIdx = subject.IndexOf(':', StringComparison.Ordinal); - if (colonIdx > 0 && colonIdx < 32 && colonIdx < subject.Length - 2 && char.IsWhiteSpace(subject[colonIdx + 1]) && _elements.Intersect(0, colonIdx + 1) == null) + var colonIdx = subject.IndexOf(": ", StringComparison.Ordinal); + if (colonIdx > 0 && colonIdx < 32 && colonIdx < subject.Length - 3 && _elements.Intersect(0, colonIdx) == null) + { _elements.Add(new Models.InlineElement(Models.InlineElementType.Keyword, 0, colonIdx + 1, string.Empty)); + } + else + { + var hyphenIdx = subject.IndexOf(" - ", StringComparison.Ordinal); + if (hyphenIdx > 0 && hyphenIdx < 32 && hyphenIdx < subject.Length - 4 && _elements.Intersect(0, hyphenIdx) == null) + { + _elements.Add(new Models.InlineElement(Models.InlineElementType.Keyword, 0, hyphenIdx, string.Empty)); + } + } } var codeMatches = REG_INLINECODE_FORMAT().Matches(subject);