1 /* 2 * Copyright 2008, Ingo Weinhold, ingo_weinhold@gmx.de. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef TERMINAL_LINE_H 6 #define TERMINAL_LINE_H 7 8 #include <SupportDefs.h> 9 10 #include "UTF8Char.h" 11 12 13 struct TerminalCell { 14 UTF8Char character; 15 uint16 attributes; 16 }; 17 18 19 struct TerminalLine { 20 uint16 length; 21 bool softBreak; // soft line break 22 TerminalCell cells[1]; 23 24 inline void Clear() 25 { 26 length = 0; 27 softBreak = false; 28 } 29 }; 30 31 32 struct AttributesRun { 33 uint16 attributes; 34 uint16 offset; // character offset 35 uint16 length; // length of the run in characters 36 }; 37 38 39 struct HistoryLine { 40 AttributesRun* attributesRuns; 41 uint16 attributesRunCount; // number of attribute runs 42 uint16 byteLength : 15; // number of bytes in the line 43 bool softBreak : 1; // soft line break; 44 45 AttributesRun* AttributesRuns() const 46 { 47 return attributesRuns; 48 } 49 50 char* Chars() const 51 { 52 return (char*)(attributesRuns + attributesRunCount); 53 } 54 55 int32 BufferSize() const 56 { 57 return attributesRunCount * sizeof(AttributesRun) + byteLength; 58 } 59 }; 60 61 62 #endif // TERMINAL_LINE_H 63