Skip to content

Commit c1634ae

Browse files
committed
feature: keyword in commit subject can end with - character
Signed-off-by: leo <longshuang@msn.cn>
1 parent df09ce0 commit c1634ae

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/Views/CommitSubjectPresenter.cs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,9 +256,19 @@ private void GenerateInlineElements()
256256
}
257257
else
258258
{
259-
var colonIdx = subject.IndexOf(':', StringComparison.Ordinal);
260-
if (colonIdx > 0 && colonIdx < 32 && colonIdx < subject.Length - 2 && char.IsWhiteSpace(subject[colonIdx + 1]) && _elements.Intersect(0, colonIdx + 1) == null)
259+
var colonIdx = subject.IndexOf(": ", StringComparison.Ordinal);
260+
if (colonIdx > 0 && colonIdx < 32 && colonIdx < subject.Length - 3 && _elements.Intersect(0, colonIdx) == null)
261+
{
261262
_elements.Add(new Models.InlineElement(Models.InlineElementType.Keyword, 0, colonIdx + 1, string.Empty));
263+
}
264+
else
265+
{
266+
var hyphenIdx = subject.IndexOf(" - ", StringComparison.Ordinal);
267+
if (hyphenIdx > 0 && hyphenIdx < 32 && hyphenIdx < subject.Length - 4 && _elements.Intersect(0, hyphenIdx) == null)
268+
{
269+
_elements.Add(new Models.InlineElement(Models.InlineElementType.Keyword, 0, hyphenIdx, string.Empty));
270+
}
271+
}
262272
}
263273

264274
var codeMatches = REG_INLINECODE_FORMAT().Matches(subject);

0 commit comments

Comments
 (0)