Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f3cbcdc9 authored by Sam Ravnborg's avatar Sam Ravnborg Committed by Sam Ravnborg
Browse files

kconfig/lxdialog: let <ESC><ESC> behave as expected



<ESC><ESC> is used to step one back in the dialogs.
When lxdialog became built-in pressing <ESC> once would cause one step back
and pressing <ESC><ESC> would cause two steps back.
This patch - based on concept from Roman Zippel <zippel@linux-m68k.org> -
makes one <ESC> a noop and pressing <ESC><ESC> will cause one step backward.

In addition the final yes/no dialog now has the option to go back to the
the kernel configuration. So if you get too far out you can now go back
to configuring the kernel without saving and starting all over again.

Signed-off-by: default avatarSam Ravnborg <sam@ravnborg.org>
parent 2982de69
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -192,7 +192,7 @@ int dialog_checklist(const char *title, const char *prompt, int height,
	wnoutrefresh(list);
	doupdate();

	while (key != ESC) {
	while (key != KEY_ESC) {
		key = wgetch(dialog);

		for (i = 0; i < max_choice; i++) {
@@ -298,8 +298,10 @@ int dialog_checklist(const char *title, const char *prompt, int height,
			break;
		case 'X':
		case 'x':
			key = ESC;
		case ESC:
			key = KEY_ESC;
			break;
		case KEY_ESC:
			key = on_key_esc(dialog);
			break;
		}

@@ -308,5 +310,5 @@ int dialog_checklist(const char *title, const char *prompt, int height,
	}
	delwin(list);
	delwin(dialog);
	return 255;		/* ESC pressed */
	return key;		/* ESC pressed */
}
+3 −1
Original line number Diff line number Diff line
@@ -48,7 +48,7 @@

#define TR(params) _tracef params

#define ESC 27
#define KEY_ESC 27
#define TAB 9
#define MAX_LEN 2048
#define BUF_SIZE (10*1024)
@@ -179,6 +179,8 @@ int item_is_tag(char tag);
	for (item_cur = item_head ? item_head: item_cur; \
	     item_cur && (item_cur != &item_nil); item_cur = item_cur->next)

/* generic key handlers */
int on_key_esc(WINDOW *win);

void init_dialog(const char *backtitle);
void reset_dialog(void);
+6 −4
Original line number Diff line number Diff line
@@ -106,7 +106,7 @@ int dialog_inputbox(const char *title, const char *prompt, int height, int width

	wrefresh(dialog);

	while (key != ESC) {
	while (key != KEY_ESC) {
		key = wgetch(dialog);

		if (button == -1) {	/* Input box selected */
@@ -215,12 +215,14 @@ int dialog_inputbox(const char *title, const char *prompt, int height, int width
			return (button == -1 ? 0 : button);
		case 'X':
		case 'x':
			key = ESC;
		case ESC:
			key = KEY_ESC;
			break;
		case KEY_ESC:
			key = on_key_esc(dialog);
			break;
		}
	}

	delwin(dialog);
	return 255;		/* ESC pressed */
	return KEY_ESC;		/* ESC pressed */
}
+6 −4
Original line number Diff line number Diff line
@@ -263,7 +263,7 @@ int dialog_menu(const char *title, const char *prompt, int height, int width,
	wmove(menu, choice, item_x + 1);
	wrefresh(menu);

	while (key != ESC) {
	while (key != KEY_ESC) {
		key = wgetch(menu);

		if (key < 256 && isalpha(key))
@@ -402,12 +402,14 @@ int dialog_menu(const char *title, const char *prompt, int height, int width,
			return button;
		case 'e':
		case 'x':
			key = ESC;
		case ESC:
			key = KEY_ESC;
			break;
		case KEY_ESC:
			key = on_key_esc(menu);
			break;
		}
	}
	delwin(menu);
	delwin(dialog);
	return 255;		/* ESC pressed */
	return key;		/* ESC pressed */
}
+4 −3
Original line number Diff line number Diff line
@@ -92,7 +92,7 @@ int dialog_textbox(const char *title, const char *tbuf, int height, int width)
	wmove(dialog, cur_y, cur_x);	/* Restore cursor position */
	wrefresh(dialog);

	while ((key != ESC) && (key != '\n')) {
	while ((key != KEY_ESC) && (key != '\n')) {
		key = wgetch(dialog);
		switch (key) {
		case 'E':	/* Exit */
@@ -228,13 +228,14 @@ int dialog_textbox(const char *title, const char *tbuf, int height, int width)
			wmove(dialog, cur_y, cur_x);
			wrefresh(dialog);
			break;
		case ESC:
		case KEY_ESC:
			key = on_key_esc(dialog);
			break;
		}
	}
	delwin(text);
	delwin(dialog);
	return 255;		/* ESC pressed */
	return key;		/* ESC pressed */
}

/*
Loading