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
This commit is contained in:
François Revol 2008-06-23 19:29:30 +00:00
parent 14fbb88f10
commit 753ef08150

View File

@ -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++;
}