cell.dart 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. import 'package:xterm/utils/hash_values.dart';
  2. class CellData {
  3. CellData({
  4. required this.foreground,
  5. required this.background,
  6. required this.flags,
  7. required this.content,
  8. });
  9. factory CellData.empty() {
  10. return CellData(
  11. foreground: 0,
  12. background: 0,
  13. flags: 0,
  14. content: 0,
  15. );
  16. }
  17. int foreground;
  18. int background;
  19. int flags;
  20. int content;
  21. int getHash() {
  22. return hashValues(foreground, background, flags, content);
  23. }
  24. @override
  25. String toString() {
  26. return 'CellData{foreground: $foreground, background: $background, flags: $flags, content: $content}';
  27. }
  28. }
  29. abstract class CellAttr {
  30. static const bold = 1 << 0;
  31. static const faint = 1 << 1;
  32. static const italic = 1 << 2;
  33. static const underline = 1 << 3;
  34. static const blink = 1 << 4;
  35. static const inverse = 1 << 5;
  36. static const invisible = 1 << 6;
  37. static const strikethrough = 1 << 7;
  38. }
  39. abstract class CellColor {
  40. static const valueMask = 0xFFFFFF;
  41. static const typeShift = 25;
  42. static const typeMask = 3 << typeShift;
  43. static const normal = 0 << typeShift;
  44. static const named = 1 << typeShift;
  45. static const palette = 2 << typeShift;
  46. static const rgb = 3 << typeShift;
  47. }
  48. abstract class CellContent {
  49. static const codepointMask = 0x1fffff;
  50. static const widthShift = 22;
  51. // static const widthMask = 3 << widthShift;
  52. }