* Petitboot to exit if they're left undefined */
define_key("\x1b\x5b\x35\x7e", KEY_PPAGE);
define_key("\x1b\x5b\x36\x7e", KEY_NPAGE);
+ define_key("\x1b\x5b\x31\x7e", KEY_HOME);
+ define_key("\x1b\x5b\x34\x7e", KEY_END);
define_key("\x1b\x4f\x48", KEY_HOME);
define_key("\x1b\x4f\x46", KEY_END);
define_key("OH", KEY_HOME);
define_key("OF", KEY_END);
+ define_key("\x1b\x5b\x41", KEY_UP);
+ define_key("\x1b\x5b\x42", KEY_DOWN);
while (getch() != ERR) /* flush stdin */
(void)0;
{
struct pmenu *menu = cui->main;
struct cui_opt_data *cod;
+ int idx, top, rows, cols;
static int user_idx = 0;
/* Was the edit cancelled? */
/* Re-attach the items array. */
set_menu_items(menu->ncm, menu->items);
+
+ /* If our index is above the current top row, align
+ * us to the new top. Otherwise, align us to the new
+ * bottom */
+ menu_format(cui->main->ncm, &rows, &cols);
+ top = top_row(cui->main->ncm);
+ idx = item_index(item->nci);
+
+ if (top >= idx)
+ top = idx;
+ else
+ top = idx < rows ? 0 : idx - rows + 1;
+
+ set_top_row(cui->main->ncm, top);
+ set_current_item(item->pmenu->ncm, item->nci);
+
nc_scr_post(&menu->scr);
} else {
cod = item->data;
cod->bd = talloc_steal(cod, bd);
- set_current_item(item->pmenu->ncm, item->nci);
out:
cui_set_current(cui, &cui->main->scr);
talloc_free(cui->boot_editor);
/* If our index is above the current top row, align
* us to the new top. Otherwise, align us to the new
* bottom */
- top = top < idx ? idx - rows : idx;
+ top = top < idx ? idx - rows + 1 : idx;
set_top_row(cui->main->ncm, top);
set_current_item(cui->main->ncm, selected);
struct cui *cui = cui_from_arg(arg);
struct boot_option *opt;
unsigned int i;
+ int rows, cols, top, last;
int result;
pb_log("%s: %p %s\n", __func__, dev, dev->id);
result = set_menu_items(cui->main->ncm, cui->main->items);
+ /* Move cursor to 'Exit' menu entry */
+ menu_format(cui->main->ncm, &rows, &cols);
+ last = cui->main->item_count - 1;
+ set_current_item(cui->main->ncm, cui->main->items[last]);
+ if (!item_visible(cui->main->items[last])) {
+ top = last < rows ? 0 : last - rows + 1;
+ set_top_row(cui->main->ncm, top);
+ }
+
if (result)
pb_log("%s: set_menu_items failed: %d\n", __func__, result);
if (cui->sysinfo_screen)
sysinfo_screen_update(cui->sysinfo_screen, sysinfo);
+ if (cui->subset_screen)
+ subset_screen_update(cui->subset_screen);
+
/* ... and do the same with the config screen... */
if (cui->config_screen)
config_screen_update(cui->config_screen, cui->config, sysinfo);
if (config->lang)
cui_update_language(cui, config->lang);
+ if (cui->subset_screen)
+ subset_screen_update(cui->subset_screen);
+
if (cui->config_screen)
config_screen_update(cui->config_screen, config, cui->sysinfo);
*/
struct cui *cui_init(void* platform_info,
- int (*js_map)(const struct js_event *e), int start_deamon)
+ int (*js_map)(const struct js_event *e), int start_daemon)
{
struct cui *cui;
unsigned int i;
/* Loop here for scripts that just started the server. */
retry_start:
- for (i = start_deamon ? 2 : 10; i; i--) {
+ for (i = start_daemon ? 2 : 15; i; i--) {
cui->client = discover_client_init(cui->waitset,
&cui_client_ops, cui);
if (cui->client || !i)
sleep(1);
}
- if (!cui->client && start_deamon) {
+ if (!cui->client && start_daemon) {
int result;
- start_deamon = 0;
+ start_daemon = 0;
result = pb_start_daemon(cui);