Re: [PATCH v2 2/2] menuconfig: add Home and End keys support for inputbox

From: Paulius Zaleckas
Date: Wed Jan 11 2012 - 04:21:26 EST


On Tue, Jan 10, 2012 at 7:30 PM, Randy Dunlap <rdunlap@xxxxxxxxxxxx> wrote:
> On 01/10/2012 03:50 AM, Paulius Zaleckas wrote:
>> On Tue, Jan 10, 2012 at 12:20 AM, Randy Dunlap <rdunlap@xxxxxxxxxxxx> wrote:
>>> On 01/09/2012 03:36 AM, Paulius Zaleckas wrote:
>>>> Makes long string editing easier.
>>>>
>>>> Signed-off-by: Paulius Zaleckas <paulius.zaleckas@xxxxxxxxx>
>>>
>>> Hi,
>>>
>>> Does "default hostname" in the "General setup" menu use an inputbox?
>>
>> Yes, it does.
>>
>>> If so, I can't get Home and End keys to work for it.
>>
>> Strange. It works for me. Have you applied both patches?
>
> Yes, I have both patches applied.

Ok this is really very strange, but I have made debug patch. See attachement.
It will print octal pressed key value just below the text field.

>From curses.h:
#define KEY_HOME 0406 /* home key */
#define KEY_END 0550 /* end key */

Do you get the same values for Home and End keys? I do.
Debug inputbox by printing octal key values.

From: Paulius Zaleckas <paulius.zaleckas@xxxxxxxxx>


---

scripts/kconfig/lxdialog/inputbox.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)


diff --git a/scripts/kconfig/lxdialog/inputbox.c b/scripts/kconfig/lxdialog/inputbox.c
index 0d9cacc..ecb778c 100644
--- a/scripts/kconfig/lxdialog/inputbox.c
+++ b/scripts/kconfig/lxdialog/inputbox.c
@@ -114,7 +114,17 @@ do_resize:
wrefresh(dialog);

while (key != KEY_ESC) {
+ char key_num[4];
+
key = wgetch(dialog);
+ snprintf(key_num, 4, "%03o", key);
+ wattrset(dialog, dlg.inputbox.atr);
+ wmove(dialog, box_y + 2, box_x);
+ waddch(dialog, key_num[0]);
+ waddch(dialog, key_num[1]);
+ waddch(dialog, key_num[2]);
+ wmove(dialog, box_y, input_x + box_x);
+ wrefresh(dialog);

if (button == -1) { /* Input box selected */
switch (key) {