@@ -279,29 +279,29 @@ protected override void OnTextChanged(EventArgs e)
279279 _isEditing = false ;
280280
281281 var caretOffset = CaretOffset ;
282- var start = caretOffset ;
283- for ( ; start > 0 ; start -- )
282+ var lineStart = caretOffset ;
283+ for ( ; lineStart > 0 ; lineStart -- )
284284 {
285- var ch = Text [ start - 1 ] ;
285+ var ch = Text [ lineStart - 1 ] ;
286286 if ( ch == '\n ' )
287287 break ;
288288
289289 if ( ! char . IsAscii ( ch ) )
290290 return ;
291291 }
292292
293- if ( caretOffset < start + 2 )
293+ if ( lineStart == 0 || caretOffset < lineStart + 2 )
294294 {
295295 _completionWnd ? . Close ( ) ;
296296 return ;
297297 }
298298
299- var word = Text . Substring ( start , caretOffset - start ) ;
299+ var word = Text . Substring ( lineStart , caretOffset - lineStart ) ;
300300 var matches = new List < CommitMessageCodeCompletionData > ( ) ;
301- foreach ( var keyword in _keywords )
301+ foreach ( var t in _trailers )
302302 {
303- if ( keyword . StartsWith ( word , StringComparison . OrdinalIgnoreCase ) && keyword . Length != word . Length )
304- matches . Add ( new ( keyword ) ) ;
303+ if ( t . StartsWith ( word , StringComparison . OrdinalIgnoreCase ) && t . Length != word . Length )
304+ matches . Add ( new ( t ) ) ;
305305 }
306306
307307 if ( matches . Count > 0 )
@@ -315,7 +315,7 @@ protected override void OnTextChanged(EventArgs e)
315315
316316 _completionWnd . CompletionList . CompletionData . Clear ( ) ;
317317 _completionWnd . CompletionList . CompletionData . AddRange ( matches ) ;
318- _completionWnd . StartOffset = start ;
318+ _completionWnd . StartOffset = lineStart ;
319319 _completionWnd . EndOffset = caretOffset ;
320320 }
321321 else
@@ -377,7 +377,22 @@ private void OnCaretPositionChanged(object sender, EventArgs e)
377377 SetCurrentValue ( ColumnProperty , col ) ;
378378 }
379379
380- private readonly List < string > _keywords = [ "Acked-by: " , "Co-authored-by: " , "Reviewed-by: " , "Signed-off-by: " , "on-behalf-of: @" , "BREAKING CHANGE: " , "Refs: " ] ;
380+ private readonly List < string > _trailers =
381+ [
382+ "Acked-by: " ,
383+ "BREAKING CHANGE: " ,
384+ "Co-authored-by: " ,
385+ "Fixes: " ,
386+ "Helped-by: " ,
387+ "Issue: " ,
388+ "on-behalf-of: @" ,
389+ "Reference-to: " ,
390+ "Refs: " ,
391+ "Reviewed-by: " ,
392+ "See-also: " ,
393+ "Signed-off-by: " ,
394+ ] ;
395+
381396 private bool _isEditing = false ;
382397 private int _subjectEndLine = 0 ;
383398 private CompletionWindow _completionWnd = null ;
0 commit comments