From 753ef081506c8f7ac38c07fc33f2e4eadb520699 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Mon, 23 Jun 2008 19:29:30 +0000 Subject: [PATCH] Fix menu item help display: it was used as index in the line buffer when it actually is an index into the whole string, so on 2nd line it was outbound... That was segfaulting some items on Atari. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26107 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/boot/platform/generic/text_menu.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/system/boot/platform/generic/text_menu.cpp b/src/system/boot/platform/generic/text_menu.cpp index f03d9496f5..466ca11fc0 100644 --- a/src/system/boot/platform/generic/text_menu.cpp +++ b/src/system/boot/platform/generic/text_menu.cpp @@ -170,20 +170,19 @@ print_item_at(int32 line, MenuItem *item, bool clearHelp = true) char *pos = strchr(buffer, '\n'); if (pos != NULL) - i = pos - buffer; + bytes = pos - buffer; else if (bytes < length - i) { // search for possible line breaks pos = strrchr(buffer, ' '); if (pos != NULL) - i = pos - buffer; + bytes = pos - buffer; else { // no wrapping possible - i += bytes; } - } else - i += bytes; + } - buffer[i] = '\0'; + i += bytes; + buffer[bytes] = '\0'; print_centered(console_height() - kHelpLines + row, buffer); row++; }