X-Git-Url: http://git.ozlabs.org/?p=petitboot;a=blobdiff_plain;f=ui%2Fncurses%2Fnc-boot-editor.c;h=5765c955fe14b53747d3b63db126110aac464062;hp=741f83595a19df99953cc7752642f93811eab5dd;hb=b7a7eb9a248f8afb1667b3e6675b49853e567ce1;hpb=e921d7bc8ed3980494518d22b0e754a6b3a603b1 diff --git a/ui/ncurses/nc-boot-editor.c b/ui/ncurses/nc-boot-editor.c index 741f835..5765c95 100644 --- a/ui/ncurses/nc-boot-editor.c +++ b/ui/ncurses/nc-boot-editor.c @@ -275,17 +275,16 @@ static void boot_editor_layout_widgets(struct boot_editor *boot_editor) static void boot_editor_widget_focus(struct nc_widget *widget, void *arg) { struct boot_editor *boot_editor = arg; - int w_y, w_height, s_max; + int w_y, s_max; - w_y = widget_y(widget); - w_height = widget_height(widget); - s_max = getmaxy(boot_editor->scr.sub_ncw); + w_y = widget_y(widget) + widget_focus_y(widget); + s_max = getmaxy(boot_editor->scr.sub_ncw) - 1; if (w_y < boot_editor->scroll_y) boot_editor->scroll_y = w_y; - else if (w_y + w_height + boot_editor->scroll_y > s_max - 1) - boot_editor->scroll_y = 1 + w_y + w_height - s_max; + else if (w_y + boot_editor->scroll_y + 1 > s_max) + boot_editor->scroll_y = 1 + w_y - s_max; else return;