menu: fixed top line computation. (nw)

This commit is contained in:
dankan1890 2016-03-03 01:52:34 +01:00
parent 028b4c5b21
commit 6d4f627035
2 changed files with 3 additions and 3 deletions

View File

@ -712,7 +712,7 @@ void ui_menu_file_selector::handle()
// from current entry to the end
for (entry = cur_selected; entry != nullptr; entry = entry->next)
{
if (entry->basename != nullptr && m_filename_buffer != nullptr)
if (entry->basename != nullptr && m_filename_buffer[0] != '\0')
{
int match = 0;
for (int i = 0; i < ARRAY_LENGTH(m_filename_buffer); i++)
@ -731,7 +731,7 @@ void ui_menu_file_selector::handle()
// and from the first entry to current one
for (entry = m_entrylist; entry != cur_selected; entry = entry->next)
{
if (entry->basename != nullptr && m_filename_buffer != nullptr)
if (entry->basename != nullptr && m_filename_buffer[0] != '\0')
{
int match = 0;
for (int i = 0; i < ARRAY_LENGTH(m_filename_buffer); i++)

View File

@ -544,7 +544,7 @@ void ui_menu::draw(bool customonly, bool noimage, bool noinput)
machine().ui().draw_outlined_box(container, x1, y1, x2, y2, UI_BACKGROUND_COLOR);
// determine the first visible line based on the current selection
if (selected > top_line + visible_lines)
if (selected > top_line + visible_lines || selected < top_line - visible_lines)
top_line = selected - (visible_lines / 2);
if (top_line < 0 || selected == 0)
top_line = 0;