summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/gui/line.c15
-rw-r--r--apps/gui/line.h11
2 files changed, 20 insertions, 6 deletions
diff --git a/apps/gui/line.c b/apps/gui/line.c
index 5a376c652c..d561f08c76 100644
--- a/apps/gui/line.c
+++ b/apps/gui/line.c
@@ -32,6 +32,7 @@
32#include "settings.h" 32#include "settings.h"
33#include "debug.h" 33#include "debug.h"
34#include "viewport.h" 34#include "viewport.h"
35#include "debug.h"
35 36
36#ifdef HAVE_REMOTE_LCD 37#ifdef HAVE_REMOTE_LCD
37#define MAX_LINES (LCD_SCROLLABLE_LINES + LCD_REMOTE_SCROLLABLE_LINES) 38#define MAX_LINES (LCD_SCROLLABLE_LINES + LCD_REMOTE_SCROLLABLE_LINES)
@@ -158,8 +159,8 @@ static void print_line(struct screen *display,
158 int xpos = x; 159 int xpos = x;
159 int icon_y, icon_h, icon_w; 160 int icon_y, icon_h, icon_w;
160 enum themable_icons icon; 161 enum themable_icons icon;
161 char tempbuf[128]; 162 char tempbuf[MAX_PATH+32];
162 int tempbuf_idx; 163 unsigned int tempbuf_idx;
163 164
164 height = line->height == -1 ? display->getcharheight() : line->height; 165 height = line->height == -1 ? display->getcharheight() : line->height;
165 icon_h = get_icon_height(display->screen_type); 166 icon_h = get_icon_height(display->screen_type);
@@ -246,7 +247,15 @@ next:
246 } 247 }
247 else 248 else
248 { /* handle string constant in format string */ 249 { /* handle string constant in format string */
249 tempbuf[tempbuf_idx++] = ch; 250 if (tempbuf_idx < sizeof(tempbuf)-1)
251 {
252 tempbuf[tempbuf_idx++] = ch;
253 }
254 else if (tempbuf_idx == sizeof(tempbuf)-1)
255 {
256 tempbuf[tempbuf_idx++] = '\0';
257 DEBUGF("%s ", ch ? "put_line: String truncated" : "");
258 }
250 if (!ch) 259 if (!ch)
251 { /* end of string. put it online */ 260 { /* end of string. put it online */
252 put_text(display, xpos, y, line, tempbuf, false, 0); 261 put_text(display, xpos, y, line, tempbuf, false, 0);
diff --git a/apps/gui/line.h b/apps/gui/line.h
index fa1522003c..9a0769de35 100644
--- a/apps/gui/line.h
+++ b/apps/gui/line.h
@@ -108,9 +108,14 @@ struct line_desc {
108 * $*t - skips the first n pixels when displaying the string. put_line() 108 * $*t - skips the first n pixels when displaying the string. put_line()
109 * expects a correspinding paramter of the type 'int' that specifies n. 109 * expects a correspinding paramter of the type 'int' that specifies n.
110 * 110 *
111 * Inline text will be printed as is and can be freely intermixed with tags, 111 * Inline text will be printed as is (be sure to escape '$') and can be freely
112 * except when the line can scroll. Due to limitations of the scroll engine 112 * intermixed with tags. Inline text will be truncated after MAX_PATH+31 bytes.
113 * only the last piece of text (whether inline or via $t) can scroll. 113 * If you have a longer inline string use a separate buffer and pass that via $t,
114 * which does not suffer from this truncation.
115 *
116 * Text can appear anywhere, before or after (or both) tags. However, when the
117 * line can scroll, only the last piece of text (whether inline or via $t) can
118 * scroll. This is due to a scroll_engine limitation.
114 * 119 *
115 * x, y - pixel postion of the line. 120 * x, y - pixel postion of the line.
116 * line - holds information for the line decorations 121 * line - holds information for the line decorations