* Copyright 2013, Haiku, Inc. All rights reserved.
* Copyright 2008, Ingo Weinhold, ingo_weinhold@gmx.de.
* Distributed under the terms of the MIT License.
*
* Authors:
* Ingo Weinhold, ingo_weinhold@gmx.de
* Siarzhuk Zharski, zharik@gmx.li
*/
#ifndef TERMINAL_LINE_H
#define TERMINAL_LINE_H
#include <SupportDefs.h>
#include "TermConst.h"
#include "UTF8Char.h"
struct TerminalCell {
UTF8Char character;
uint32 attributes;
};
struct TerminalLine {
uint16 length;
bool softBreak;
uint32 attributes;
TerminalCell cells[1];
inline void Clear(uint32 attr = 0, size_t count = 0)
{
length = 0;
attributes = attr;
softBreak = false;
for (size_t i = 0; i < count; i++)
cells[i].attributes = attr;
}
};
struct AttributesRun {
uint32 attributes;
uint16 offset;
uint16 length;
};
struct HistoryLine {
AttributesRun* attributesRuns;
uint16 attributesRunCount;
uint16 byteLength : 15;
bool softBreak : 1;
uint32 attributes;
AttributesRun* AttributesRuns() const
{
return attributesRuns;
}
char* Chars() const
{
return (char*)(attributesRuns + attributesRunCount);
}
int32 BufferSize() const
{
return attributesRunCount * sizeof(AttributesRun) + byteLength;
}
};
#endif