From bbd7e671ba66fcbdefef7d959a70948c301536a3 Mon Sep 17 00:00:00 2001
From: Christian Heller <c.heller@plomlompom.de>
Date: Sat, 5 Sep 2015 02:12:40 +0200
Subject: [PATCH] Client: Fix log window drawing bug (too small winmap
 allocated).

---
 TODO                   | 2 ++
 src/client/draw_wins.c | 3 ++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/TODO b/TODO
index c0428f7..212f582 100644
--- a/TODO
+++ b/TODO
@@ -20,3 +20,5 @@ CLIENT:
 - re-work unnecessary complex command / keybinding / server message mapping
 
 - only send "ITEM_HERE" query to server when the dependent window is open
+
+- draw_win_log() is still buggy (make mem alloc for other line break styles!)
diff --git a/src/client/draw_wins.c b/src/client/draw_wins.c
index 9857af5..e409d87 100644
--- a/src/client/draw_wins.c
+++ b/src/client/draw_wins.c
@@ -361,7 +361,7 @@ extern void draw_win_log(struct Win * win)
         if (x > win->frame_size.x || '\n' == world.log[i])
         {
             n_postbreak_lines++;
-            x = 0;
+            x = 1;
         }
     }
     if (n_postbreak_lines > win->frame_size.y)
@@ -369,6 +369,7 @@ extern void draw_win_log(struct Win * win)
         uint32_t size = n_postbreak_lines * (win->frame_size.x + 1);
         win->winmap = try_malloc(sizeof(chtype) * size, __func__);
         for (i = 0; i < size; win->winmap[i] = ' ', i++);
+        /* TODO: This should only be done with "long" line break style. */
         do_realloc_winmap = 0;
         draw_text_from_bottom(win, world.log);
         do_realloc_winmap = 1;
-- 
2.30.2