Skip to content

Commit eac1c11

Browse files
committed
enhance: render fixup!, amend!, squash! as keyword in commit subject (#2375)
Signed-off-by: leo <longshuang@msn.cn>
1 parent d061a50 commit eac1c11

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

src/Views/CommitSubjectPresenter.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,15 @@ private void GenerateInlineElements()
248248
foreach (var rule in rules)
249249
rule.Matches(_elements, subject);
250250

251-
if (subject.StartsWith('['))
251+
if (subject.StartsWith("fixup! ", StringComparison.Ordinal) || subject.StartsWith("amend! ", StringComparison.Ordinal))
252+
{
253+
_elements.Add(new Models.InlineElement(Models.InlineElementType.Keyword, 0, 6, string.Empty));
254+
}
255+
else if (subject.StartsWith("squash! ", StringComparison.Ordinal))
256+
{
257+
_elements.Add(new Models.InlineElement(Models.InlineElementType.Keyword, 0, 7, string.Empty));
258+
}
259+
else if (subject.StartsWith('['))
252260
{
253261
var bracketIdx = subject.IndexOf(']');
254262
if (bracketIdx > 1 && bracketIdx < 50 && _elements.Intersect(0, bracketIdx + 1) == null)

0 commit comments

Comments
 (0)