yaft: remove unnecessary lines_available variable

This commit is contained in:
Stefan Seyfried
2018-01-27 19:21:59 +01:00
committed by Thilo Graf
parent 4ee09e175d
commit 6b14e13fea
4 changed files with 4 additions and 12 deletions

View File

@@ -46,7 +46,6 @@ void YaFT_p::tab(void)
void YaFT_p::nl(void) void YaFT_p::nl(void)
{ {
txt.push(""); txt.push("");
lines_available++;
move_cursor(1, 0); move_cursor(1, 0);
} }

View File

@@ -175,7 +175,7 @@ int YaFT::run(void)
if (FD_ISSET(term->fd, &fds)) { if (FD_ISSET(term->fd, &fds)) {
while ((size = read(term->fd, buf, BUFSIZE)) > 0) { while ((size = read(term->fd, buf, BUFSIZE)) > 0) {
term->parse(buf, size); term->parse(buf, size);
while (term->lines_available > 0) { while (term->txt.size() > 1) {
std::string s = term->txt.front(); std::string s = term->txt.front();
OnShellOutputLoop(&s, res, &ok); OnShellOutputLoop(&s, res, &ok);
#if 0 #if 0
@@ -184,9 +184,8 @@ int YaFT::run(void)
else else
printf("[CTermWindow] [%s:%d] res=NULL ok=%d\n", __func__, __LINE__, ok); printf("[CTermWindow] [%s:%d] res=NULL ok=%d\n", __func__, __LINE__, ok);
#endif #endif
// fprintf(stderr, "%d %s\n", term.lines_available, term.txt.front().c_str()); // fprintf(stderr, "size %d '%s'\n", term->txt.size(), s.c_str());
term->txt.pop(); term->txt.pop();
term->lines_available--;
} }
if (! paint) if (! paint)
continue; continue;

View File

@@ -85,7 +85,6 @@ extern std::string ttx_font_file;
* a command but don't display anything */ * a command but don't display anything */
YaFT_p::YaFT_p(bool Paint) YaFT_p::YaFT_p(bool Paint)
{ {
lines_available = 0;
txt.push(""); txt.push("");
nlseen = false; nlseen = false;
paint = Paint; paint = Paint;
@@ -232,10 +231,8 @@ void YaFT_p::move_cursor(int y_offset, int x_offset)
} }
cursor.y = y; cursor.y = y;
if (y_offset > 0 && !nlseen) { if (y_offset > 0 && !nlseen)
txt.push(""); txt.push("");
lines_available++;
}
} }
/* absolute movement: never scroll */ /* absolute movement: never scroll */
@@ -255,10 +252,8 @@ void YaFT_p::set_cursor(int y, int x)
x = (x < 0) ? 0: (x >= cols) ? cols - 1: x; x = (x < 0) ? 0: (x >= cols) ? cols - 1: x;
y = (y < top) ? top: (y > bottom) ? bottom: y; y = (y < top) ? top: (y > bottom) ? bottom: y;
if (cursor.y != y && !nlseen) { if (cursor.y != y && !nlseen)
txt.push(""); txt.push("");
lines_available++;
}
cursor.x = x; cursor.x = x;
cursor.y = y; cursor.y = y;

View File

@@ -179,7 +179,6 @@ class YaFT_p
int cols, lines; /* terminal size (cell) */ int cols, lines; /* terminal size (cell) */
time_t last_paint; time_t last_paint;
std::queue<std::string> txt; /* contains "sanitized" (without control chars) output text */ std::queue<std::string> txt; /* contains "sanitized" (without control chars) output text */
int lines_available; /* lines available in txt */
YaFT_p(bool paint = true); YaFT_p(bool paint = true);
~YaFT_p(); ~YaFT_p();