lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <257b264c328253acda17ebafd7be6740021b1707.1634383536.git.josh@joshtriplett.org>
Date:   Sat, 16 Oct 2021 13:26:50 +0200
From:   Josh Triplett <josh@...htriplett.org>
To:     Masahiro Yamada <masahiroy@...nel.org>
Cc:     linux-kbuild@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] kconfig: lxdialog: Support home/end when editing values

When editing long string values, this makes navigation much easier.

Signed-off-by: Josh Triplett <josh@...htriplett.org>
---

Ran into this when repeatedly editing CONFIG_CMDLINE and wanting to
change the first value.

 scripts/kconfig/lxdialog/inputbox.c | 33 +++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/scripts/kconfig/lxdialog/inputbox.c b/scripts/kconfig/lxdialog/inputbox.c
index 1dcfb288ee63..25c7cb05b3da 100644
--- a/scripts/kconfig/lxdialog/inputbox.c
+++ b/scripts/kconfig/lxdialog/inputbox.c
@@ -181,6 +181,39 @@ int dialog_inputbox(const char *title, const char *prompt, int height, int width
 					pos++;
 				}
 				continue;
+			case KEY_HOME:
+				if (pos > 0) {
+					pos = show_x = input_x = 0;
+					wmove(dialog, box_y, box_x);
+					for (i = 0; i < box_width; i++)
+						waddch(dialog, ' ');
+					wmove(dialog, box_y, box_x);
+					for (i = 0; i < box_width && instr[show_x + i]; i++)
+						waddch(dialog, instr[show_x + i]);
+					wmove(dialog, box_y, box_x);
+				}
+				continue;
+			case KEY_END:
+				if (pos < len) {
+					pos = len;
+					wmove(dialog, box_y, box_x);
+					for (i = 0; i < box_width; i++)
+						waddch(dialog, ' ');
+					wmove(dialog, box_y, box_x);
+					if (len < box_width) {
+						show_x = 0;
+						input_x = box_width - 1;
+						for (i = 0; i < box_width && instr[show_x + i]; i++)
+							waddch(dialog, instr[show_x + i]);
+					} else {
+						show_x = len - box_width + 1;
+						input_x = box_width - 1;
+					}
+					for (i = 0; i < box_width && instr[show_x + i]; i++)
+						waddch(dialog, instr[show_x + i]);
+					wmove(dialog, box_y, input_x + box_x);
+				}
+				continue;
 			default:
 				if (key < 0x100 && isprint(key)) {
 					if (len < MAX_LEN) {
-- 
2.33.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ