btrfs: Attempt to fix GCC2 build.
[haiku.git] / src / apps / terminal / TerminalLine.h
blob044cce7d993c649a4311f1dfebe2b9fe53613426
1 /*
2 * Copyright 2013, Haiku, Inc. All rights reserved.
3 * Copyright 2008, Ingo Weinhold, ingo_weinhold@gmx.de.
4 * Distributed under the terms of the MIT License.
6 * Authors:
7 * Ingo Weinhold, ingo_weinhold@gmx.de
8 * Siarzhuk Zharski, zharik@gmx.li
9 */
10 #ifndef TERMINAL_LINE_H
11 #define TERMINAL_LINE_H
13 #include <SupportDefs.h>
15 #include "TermConst.h"
17 #include "UTF8Char.h"
20 struct TerminalCell {
21 UTF8Char character;
22 uint32 attributes;
26 struct TerminalLine {
27 uint16 length;
28 bool softBreak; // soft line break
29 uint32 attributes;
30 TerminalCell cells[1];
32 inline void Clear(uint32 attr = 0, size_t count = 0)
34 length = 0;
35 attributes = attr;
36 softBreak = false;
37 for (size_t i = 0; i < count; i++)
38 cells[i].attributes = attr;
43 struct AttributesRun {
44 uint32 attributes;
45 uint16 offset; // character offset
46 uint16 length; // length of the run in characters
50 struct HistoryLine {
51 AttributesRun* attributesRuns;
52 uint16 attributesRunCount; // number of attribute runs
53 uint16 byteLength : 15; // number of bytes in the line
54 bool softBreak : 1; // soft line break;
55 uint32 attributes;
57 AttributesRun* AttributesRuns() const
59 return attributesRuns;
62 char* Chars() const
64 return (char*)(attributesRuns + attributesRunCount);
67 int32 BufferSize() const
69 return attributesRunCount * sizeof(AttributesRun) + byteLength;
74 #endif // TERMINAL_LINE_H