| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137 |
- import 'package:xterm/core/cell.dart';
- class CursorStyle {
- int foreground;
- int background;
- int attrs;
- CursorStyle({this.foreground = 0, this.background = 0, this.attrs = 0});
- static final empty = CursorStyle();
- void setBold() {
- attrs |= CellAttr.bold;
- }
- void setFaint() {
- attrs |= CellAttr.faint;
- }
- void setItalic() {
- attrs |= CellAttr.italic;
- }
- void setUnderline() {
- attrs |= CellAttr.underline;
- }
- void setBlink() {
- attrs |= CellAttr.blink;
- }
- void setInverse() {
- attrs |= CellAttr.inverse;
- }
- void setInvisible() {
- attrs |= CellAttr.invisible;
- }
- void setStrikethrough() {
- attrs |= CellAttr.strikethrough;
- }
- void unsetBold() {
- attrs &= ~CellAttr.bold;
- }
- void unsetFaint() {
- attrs &= ~CellAttr.faint;
- }
- void unsetItalic() {
- attrs &= ~CellAttr.italic;
- }
- void unsetUnderline() {
- attrs &= ~CellAttr.underline;
- }
- void unsetBlink() {
- attrs &= ~CellAttr.blink;
- }
- void unsetInverse() {
- attrs &= ~CellAttr.inverse;
- }
- void unsetInvisible() {
- attrs &= ~CellAttr.invisible;
- }
- void unsetStrikethrough() {
- attrs &= ~CellAttr.strikethrough;
- }
- bool get isBold => (attrs & CellAttr.bold) != 0;
- bool get isFaint => (attrs & CellAttr.faint) != 0;
- bool get isItalis => (attrs & CellAttr.italic) != 0;
- bool get isUnderline => (attrs & CellAttr.underline) != 0;
- bool get isBlink => (attrs & CellAttr.blink) != 0;
- bool get isInverse => (attrs & CellAttr.inverse) != 0;
- bool get isInvisible => (attrs & CellAttr.invisible) != 0;
- void setForegroundColor16(int color) {
- foreground = color | CellColor.named;
- }
- void setForegroundColor256(int color) {
- foreground = color | CellColor.palette;
- }
- void setForegroundColorRgb(int r, int g, int b) {
- foreground = (r << 16) | (g << 8) | b | CellColor.rgb;
- }
- void resetForegroundColor() {
- foreground = 0; // | CellColor.normal;
- }
- void setBackgroundColor16(int color) {
- background = color | CellColor.named;
- }
- void setBackgroundColor256(int color) {
- background = color | CellColor.palette;
- }
- void setBackgroundColorRgb(int r, int g, int b) {
- background = (r << 16) | (g << 8) | b | CellColor.rgb;
- }
- void resetBackgroundColor() {
- background = 0; // | CellColor.normal;
- }
- void reset() {
- foreground = 0;
- background = 0;
- attrs = 0;
- }
- }
- class CursorPosition {
- int x;
- int y;
- CursorPosition(this.x, this.y);
- }
|