|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef TERMINAL_H |
|
|
#define TERMINAL_H |
|
|
|
|
|
#include <windows.h> |
|
|
#include <stdint.h> |
|
|
|
|
|
#include <string> |
|
|
#include <vector> |
|
|
|
|
|
#include "Coord.h" |
|
|
|
|
|
class NamedPipe; |
|
|
|
|
|
class Terminal |
|
|
{ |
|
|
public: |
|
|
explicit Terminal(NamedPipe &output, bool plainMode, bool outputColor) |
|
|
: m_output(output), m_plainMode(plainMode), m_outputColor(outputColor) |
|
|
{ |
|
|
} |
|
|
|
|
|
enum SendClearFlag { OmitClear, SendClear }; |
|
|
void reset(SendClearFlag sendClearFirst, int64_t newLine); |
|
|
void sendLine(int64_t line, const CHAR_INFO *lineData, int width, |
|
|
int cursorColumn); |
|
|
void showTerminalCursor(int column, int64_t line); |
|
|
void hideTerminalCursor(); |
|
|
|
|
|
private: |
|
|
void moveTerminalToLine(int64_t line); |
|
|
|
|
|
public: |
|
|
void enableMouseMode(bool enabled); |
|
|
|
|
|
private: |
|
|
NamedPipe &m_output; |
|
|
int64_t m_remoteLine = 0; |
|
|
int m_remoteColumn = 0; |
|
|
bool m_lineDataValid = true; |
|
|
std::vector<CHAR_INFO> m_lineData; |
|
|
bool m_cursorHidden = false; |
|
|
int m_remoteColor = -1; |
|
|
std::string m_termLineWorkingBuffer; |
|
|
bool m_plainMode = false; |
|
|
bool m_outputColor = true; |
|
|
bool m_mouseModeEnabled = false; |
|
|
}; |
|
|
|
|
|
#endif |
|
|
|