scripts: menuconfig: proper handling of NULL character as input
Fixes: #33212 Upstream PR: https://github.com/ulfalizer/Kconfiglib/pull/103 Ignoring when user inputs NULL in a text field. menuconfig exits with a python stack trace if NULL is provided as input character, therefore ignore NULL as an input character to prevent this behaviour. A NULL character may be given accidentally by the user through the following ways: - Pressing `Win` key on keyboard (Windows only) - Pressing `<CTRL>-@` / `<CTRL>-2`. Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
This commit is contained in:
parent
cd465ff8c4
commit
d33fc38e09
1 changed files with 6 additions and 0 deletions
|
|
@ -1757,6 +1757,9 @@ def _input_dialog(title, initial_text, info_text=None):
|
||||||
_safe_curs_set(0)
|
_safe_curs_set(0)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
elif c == "\0": # \0 = NUL, ignore
|
||||||
|
pass
|
||||||
|
|
||||||
else:
|
else:
|
||||||
s, i, hscroll = _edit_text(c, s, i, hscroll, edit_width())
|
s, i, hscroll = _edit_text(c, s, i, hscroll, edit_width())
|
||||||
|
|
||||||
|
|
@ -2196,6 +2199,9 @@ def _jump_to_dialog():
|
||||||
elif c == curses.KEY_HOME:
|
elif c == curses.KEY_HOME:
|
||||||
sel_node_i = scroll = 0
|
sel_node_i = scroll = 0
|
||||||
|
|
||||||
|
elif c == "\0": # \0 = NUL, ignore
|
||||||
|
pass
|
||||||
|
|
||||||
else:
|
else:
|
||||||
s, s_i, hscroll = _edit_text(c, s, s_i, hscroll,
|
s, s_i, hscroll = _edit_text(c, s, s_i, hscroll,
|
||||||
_width(edit_box) - 2)
|
_width(edit_box) - 2)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue