AutocompleteContext.cs 1000 B

123456789101112131415161718192021222324252627282930313233343536
  1. using System.Collections.Generic;
  2. using System.Text;
  3. namespace Terminal.Gui {
  4. /// <summary>
  5. /// Describes the current state of a <see cref="View"/> which
  6. /// is proposing autocomplete. Suggestions are based on this state.
  7. /// </summary>
  8. public class AutocompleteContext
  9. {
  10. /// <summary>
  11. /// The text on the current line.
  12. /// </summary>
  13. public List<RuneCell> CurrentLine { get; set; }
  14. /// <summary>
  15. /// The position of the input cursor within the <see cref="CurrentLine"/>.
  16. /// </summary>
  17. public int CursorPosition { get; set; }
  18. /// <summary>
  19. /// Gets or sets if the autocomplete was canceled from popup.
  20. /// </summary>
  21. public bool Canceled { get; set; }
  22. /// <summary>
  23. /// Creates a new instance of the <see cref="AutocompleteContext"/> class
  24. /// </summary>
  25. public AutocompleteContext (List<RuneCell> currentLine, int cursorPosition, bool canceled = false)
  26. {
  27. CurrentLine = currentLine;
  28. CursorPosition = cursorPosition;
  29. Canceled = canceled;
  30. }
  31. }
  32. }