2
0

AutocompleteContext.cs 941 B

123456789101112131415161718192021222324252627
  1. #nullable disable
  2. namespace Terminal.Gui.Views;
  3. /// <summary>
  4. /// Describes the current state of a <see cref="View"/> which is proposing autocomplete. Suggestions are based on
  5. /// this state.
  6. /// </summary>
  7. public class AutocompleteContext
  8. {
  9. /// <summary>Creates a new instance of the <see cref="AutocompleteContext"/> class</summary>
  10. public AutocompleteContext (List<Cell> currentLine, int cursorPosition, bool canceled = false)
  11. {
  12. CurrentLine = currentLine;
  13. CursorPosition = cursorPosition;
  14. Canceled = canceled;
  15. }
  16. /// <summary>Gets or sets if the autocomplete was canceled from popup.</summary>
  17. public bool Canceled { get; set; }
  18. /// <summary>The text on the current line.</summary>
  19. public List<Cell> CurrentLine { get; set; }
  20. /// <summary>The position of the input cursor within the <see cref="CurrentLine"/>.</summary>
  21. public int CursorPosition { get; set; }
  22. }