about summary refs log tree commit diff stats
path: root/src/ui
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2014-11-09 23:29:25 +0000
committerJames Booth <boothj5@gmail.com>2014-11-09 23:29:25 +0000
commit46583839df397ce9634d147a28e79134b7045ea9 (patch)
treed3f699fe3c29d7b5a46990cfae261fef1599d40e /src/ui
parent70501f5dbf1b8d80b80c7b24e0e6ab46921ba7dd (diff)
downloadprofani-tty-46583839df397ce9634d147a28e79134b7045ea9.tar.gz
Added /wrap user preference for enabling/disabling word wrapping
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/console.c11
-rw-r--r--src/ui/ui.h1
-rw-r--r--src/ui/window.c7
3 files changed, 17 insertions, 2 deletions
diff --git a/src/ui/console.c b/src/ui/console.c
index 2b5dec8a..6a995a1a 100644
--- a/src/ui/console.c
+++ b/src/ui/console.c
@@ -841,6 +841,15 @@ _cons_beep_setting(void)
 }
 
 static void
+_cons_wrap_setting(void)
+{
+    if (prefs_get_boolean(PREF_WRAP))
+        cons_show("Word wrap (/wrap)             : ON");
+    else
+        cons_show("Word wrap (/wrap)             : OFF");
+}
+
+static void
 _cons_presence_setting(void)
 {
     if (prefs_get_boolean(PREF_PRESENCE))
@@ -941,6 +950,7 @@ _cons_show_ui_prefs(void)
     cons_beep_setting();
     cons_flash_setting();
     cons_splash_setting();
+    cons_wrap_setting();
     cons_vercheck_setting();
     cons_mouse_setting();
     cons_statuses_setting();
@@ -1557,6 +1567,7 @@ console_init_module(void)
     cons_theme_setting = _cons_theme_setting;
     cons_privileges_setting = _cons_privileges_setting;
     cons_beep_setting = _cons_beep_setting;
+    cons_wrap_setting = _cons_wrap_setting;
     cons_presence_setting = _cons_presence_setting;
     cons_flash_setting = _cons_flash_setting;
     cons_splash_setting = _cons_splash_setting;
diff --git a/src/ui/ui.h b/src/ui/ui.h
index f5c9b621..e2ede545 100644
--- a/src/ui/ui.h
+++ b/src/ui/ui.h
@@ -300,6 +300,7 @@ void (*cons_splash_setting)(void);
 void (*cons_vercheck_setting)(void);
 void (*cons_occupants_setting)(void);
 void (*cons_presence_setting)(void);
+void (*cons_wrap_setting)(void);
 void (*cons_mouse_setting)(void);
 void (*cons_statuses_setting)(void);
 void (*cons_titlebar_setting)(void);
diff --git a/src/ui/window.c b/src/ui/window.c
index 6f224a04..d245a333 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -583,10 +583,13 @@ _win_print(ProfWin *window, const char show_char, const char * const date_fmt,
 
     wattron(window->win, attrs);
 
-    if (flags & NO_EOL) {
+    if (prefs_get_boolean(PREF_WRAP)) {
         _win_print_wrapped(window->win, message+offset);
     } else {
-        _win_print_wrapped(window->win, message+offset);
+        wprintw(window->win, "%s", message+offset);
+    }
+
+    if ((flags & NO_EOL) == 0) {
         wprintw(window->win, "\n");
     }