That Terminal
A terminal emulator designed for video making purposes.
terminal.hh
Go to the documentation of this file.
1 #ifndef bqtTTYterminalHH
2 #define bqtTTYterminalHH
7 #include <deque>
8 #include <string>
9 #include <vector>
10 #include <array>
11 
12 #include "window.hh"
13 
16 {
17 private:
18  Window& wnd;
19 
20 public:
21  std::deque<char32_t> OutBuffer;
22 
23 private:
24  std::size_t top;
25  std::size_t bottom;
26 
27  struct backup
28  {
29  std::size_t cx;
30  std::size_t cy;
31  Cell attr;
32  } backup;
33 
34  std::array<unsigned char,4> gset;
35  unsigned char activeset;
36  unsigned char utfmode;
37  unsigned char scs;
38 
39  char32_t lastch = U' ';
40 
41  std::vector<unsigned> p;
42 
43  unsigned state=0;
44  bool edgeflag=false;
45  std::u32string string;
46 
47 private:
48  void ResetAttr();
50  void Reset(bool full = true);
51 
58  void YScrollDown(unsigned y1, unsigned y2, int amount) const;
59 
66  void YScrollUp(unsigned y1, unsigned y2, int amount) const;
67 
68  void SaveCur();
69  void RestoreCur();
70  void EchoBack(std::u32string_view buffer);
71 public:
78  void Write(std::u32string_view s);
79 
81  TerminalWindow(Window& w): wnd(w)
82  {
83  ResetAttr();
84  Reset();
85  SaveCur();
86  }
87 
89  void Resize(std::size_t newsx, std::size_t newsy);
90 };
91 
92 #endif
Definition: terminal.hh:16
TerminalWindow(Window &w)
Definition: terminal.hh:81
std::deque< char32_t > OutBuffer
Outgoing symbols (some ANSI codes cause input to be generated)
Definition: terminal.hh:21
void Write(std::u32string_view s)
Definition: terminal.cc:68
void Resize(std::size_t newsx, std::size_t newsy)
Definition: terminal.cc:1126
Definition: cell.hh:39
Definition: window.hh:17
Defines Window, a renderer and manager of screen contents.