diff options
author | Darkvater <darkvater@openttd.org> | 2005-05-30 16:03:21 +0000 |
---|---|---|
committer | Darkvater <darkvater@openttd.org> | 2005-05-30 16:03:21 +0000 |
commit | d0a0d6fcb5193c2b0a3b744147332ec2b24f213e (patch) | |
tree | b3abbef3ec0c78027bf6b01ef5ca1b7b224c77fe /misc_gui.c | |
parent | 0cd53574ec659e283a0029f6cd037ffd66999e60 (diff) | |
download | openttd-d0a0d6fcb5193c2b0a3b744147332ec2b24f213e.tar.xz |
(svn r2385) - Feature: shortcut CTRL + U that clears the commandline of the current input-box. As requested by Tron.
Diffstat (limited to 'misc_gui.c')
-rw-r--r-- | misc_gui.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/misc_gui.c b/misc_gui.c index 37d7c2509..63fb1b6ef 100644 --- a/misc_gui.c +++ b/misc_gui.c @@ -784,6 +784,17 @@ bool DeleteTextBufferChar(Textbuf *tb, int delmode) } /** + * Delete every character in the textbuffer + * @param tb @Textbuf buffer to be emptied + */ +void DeleteTextBufferAll(Textbuf *tb) +{ + memset(tb->buf, 0, tb->maxlength); + tb->length = tb->width = 0; + tb->caretpos = tb->caretxoffs = 0; +} + +/** * Insert a character to a textbuffer. If maxlength is zero, we don't care about * the screenlength but only about the physical length of the string * @param tb @Textbuf type to be changed @@ -875,6 +886,10 @@ int HandleEditBoxKey(Window *w, int wid, WindowEvent *we) if (InsertTextBufferClipboard(&WP(w, querystr_d).text)) InvalidateWidget(w, wid); break; + case (WKC_CTRL | 'U'): + DeleteTextBufferAll(&WP(w, querystr_d).text); + InvalidateWidget(w, wid); + break; case WKC_BACKSPACE: case WKC_DELETE: if (DeleteTextBufferChar(&WP(w, querystr_d).text, we->keypress.keycode)) InvalidateWidget(w, wid); |