aboutsummaryrefslogtreecommitdiffstats
path: root/display.c
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2014-04-09 00:10:22 -0400
committerJesse Luehrs <doy@tozt.net>2014-04-09 00:10:22 -0400
commitef5cd6e10e93ef973536d2df2ad57ac42a2118ea (patch)
treefb48ab2dc9caaa4fb2f7703c317e232671d786a9 /display.c
parent7b94ce2eb3319875de5da0212f3435a2fb1adc83 (diff)
downloadrunes-ef5cd6e10e93ef973536d2df2ad57ac42a2118ea.tar.gz
runes-ef5cd6e10e93ef973536d2df2ad57ac42a2118ea.zip
handle newlines vaguely better
Diffstat (limited to 'display.c')
-rw-r--r--display.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/display.c b/display.c
index 8b732a1..5d503bd 100644
--- a/display.c
+++ b/display.c
@@ -1,3 +1,5 @@
+#include <string.h>
+
#include "runes.h"
void runes_display_init(RunesTerm *t)
@@ -11,7 +13,16 @@ void runes_display_init(RunesTerm *t)
void runes_display_glyph(RunesTerm *t, char *buf, size_t len)
{
if (len) {
+ char *nl;
buf[len] = '\0';
+ while ((nl = strchr(buf, '\n'))) {
+ double x, y;
+ *nl = '\0';
+ cairo_show_text(t->cr, buf);
+ buf = nl + 1;
+ cairo_get_current_point(t->cr, &x, &y);
+ cairo_move_to(t->cr, 0.0, y + 14.0);
+ }
cairo_show_text(t->cr, buf);
}
}