summaryrefslogtreecommitdiff
path: root/src/server/client.cpp
diff options
context:
space:
mode:
authorJuan Manuel Tomás <jtomas1815@gmail.com>2020-07-22 22:52:51 -0300
committerJuan Manuel Tomás <jtomas1815@gmail.com>2020-07-22 22:52:51 -0300
commitdacf6e0625d10ff47d2aad0ca8d705f90f030119 (patch)
treebfb7f55d024c96b2390bd5f999455b2285542828 /src/server/client.cpp
parentba2c428dca0080cd79ea3e6c7d0f48764076fd2c (diff)
downloadjet-dacf6e0625d10ff47d2aad0ca8d705f90f030119.tar.gz
jet-dacf6e0625d10ff47d2aad0ca8d705f90f030119.zip
Update architecture
Diffstat (limited to 'src/server/client.cpp')
-rw-r--r--src/server/client.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/server/client.cpp b/src/server/client.cpp
index d862b13..75c1c38 100644
--- a/src/server/client.cpp
+++ b/src/server/client.cpp
@@ -57,12 +57,17 @@ struct Client {
void show(size_t window_w, size_t window_h) {
char *view = new char[window_w * window_h];
+ int *line_ends = new int[window_h];
+ for (int i = 0; i < window_h; i++) {
+ line_ends[i] = window_w;
+ }
Point window_end(window_start);
for (int i = 0; i < window_h; i++) {
for (int j = 0; j < window_w; j++) {
view[pos(j, i)] = window_end.element();
if (window_end.element() == '\n') {
+ line_ends[i] = j;
for (int k = j + 1; k < window_w; k++) {
view[pos(k, i)] = 0;
}
@@ -78,7 +83,9 @@ struct Client {
}
io.send(view, window_w * window_h);
+ io.send(line_ends, window_h);
delete[] view;
+ delete[] line_ends;
}
void move(int64_t target) {