summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/text.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/text.c b/src/text.c
index 2ae5a66..10996c5 100644
--- a/src/text.c
+++ b/src/text.c
@@ -40,6 +40,7 @@ text_new(const char *string)
{
struct text *text;
int width;
+ int eol;
if (!string) {
return NULL;
@@ -52,6 +53,7 @@ text_new(const char *string)
text->string = string;
width = 0;
+ eol = 0;
while (string && *string) {
if (*string == 0x1B && *(string + 1) == '[') { /* CSI */
string += 2;
@@ -60,16 +62,22 @@ text_new(const char *string)
if (*string >= 0x40 && *string <= 0x7E) {
++string;
}
+ eol = 0;
} else if (*string == '\n') {
text->width = MAX(text->width, width);
width = 0;
++text->height;
++string;
+ eol = 1;
} else {
++width;
++string;
+ eol = 0;
}
}
+ if (!eol) {
+ ++text->height;
+ }
return text;
}