about summary refs log tree commit diff stats
path: root/src/ui/window.c
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2014-11-08 21:16:16 +0000
committerJames Booth <boothj5@gmail.com>2014-11-08 21:16:16 +0000
commitda376b26d6e9ea688ce3ad575151011b16c75ac4 (patch)
treef5cbf7d7e09d98b9d3394f62362998b21bb0c06e /src/ui/window.c
parentecef8f79564d099c3f8a244acb3530411538ad69 (diff)
downloadprofani-tty-da376b26d6e9ea688ce3ad575151011b16c75ac4.tar.gz
Simple word wrap
Diffstat (limited to 'src/ui/window.c')
-rw-r--r--src/ui/window.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/ui/window.c b/src/ui/window.c
index 7bb1e973..00d95bbb 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -610,6 +610,16 @@ _win_print_wrapped(WINDOW *win, const char * const message)
                 word[wordi++] = message[linei++];
             }
             word[wordi] = '\0';
+
+            int curx = getcurx(win);
+            int maxx = getmaxx(win);
+
+            if (curx + strlen(word) > maxx) {
+                wprintw(win, "\n           ");
+            }
+            if (curx < 11) {
+                wprintw(win, "           ");
+            }
             wprintw(win, "%s", word);
         }
     }