]> Pileus Git - lackey/commitdiff
Prevent line wrapping for descriptions
authorAndy Spencer <andy753421@gmail.com>
Mon, 24 Jun 2013 02:16:39 +0000 (02:16 +0000)
committerAndy Spencer <andy753421@gmail.com>
Mon, 24 Jun 2013 02:21:53 +0000 (02:21 +0000)
views/events.c

index b23c0f55cfc7c19f8a24fd92fb42a01eeb657cb0..9d7434c3459dc98af79c5b9ea6f5c3125945c18e 100644 (file)
@@ -15,6 +15,7 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <string.h>
 #include <ncurses.h>
 
 #include "util.h"
 #include <ncurses.h>
 
 #include "util.h"
@@ -87,8 +88,10 @@ void events_draw(void)
                        /* Print event info */
                        event_line(win, event, row++-line, 4, COLS-4,
                                        SHOW_DETAILS | SHOW_ACTIVE);
                        /* Print event info */
                        event_line(win, event, row++-line, 4, COLS-4,
                                        SHOW_DETAILS | SHOW_ACTIVE);
-                       if (event->name && event->desc)
-                               mvwprintw(win, row++-line, 14, "%s", event->desc);
+                       if (event->name && event->desc) {
+                               int n = MIN(COLS-14, strcspn(event->desc, "\n"));
+                               mvwprintw(win, row++-line, 14, "%.*s", n, event->desc);
+                       }
 
                        cur = next;
                        count += 1;
 
                        cur = next;
                        count += 1;