(svn r2385) - Feature: shortcut CTRL + U that clears the commandline of the current input-box. As requested by Tron.
This commit is contained in:
		| @@ -154,6 +154,10 @@ static void IConsoleWndProc(Window* w, WindowEvent* e) | |||||||
| 				case (WKC_CTRL | 'L'): | 				case (WKC_CTRL | 'L'): | ||||||
| 					IConsoleCmdExec("clear"); | 					IConsoleCmdExec("clear"); | ||||||
| 					break; | 					break; | ||||||
|  | 				case (WKC_CTRL | 'U'): | ||||||
|  | 					DeleteTextBufferAll(&_iconsole_cmdline); | ||||||
|  | 					SetWindowDirty(w); | ||||||
|  | 					break; | ||||||
| 				case WKC_BACKSPACE: case WKC_DELETE: | 				case WKC_BACKSPACE: case WKC_DELETE: | ||||||
| 					if (DeleteTextBufferChar(&_iconsole_cmdline, e->keypress.keycode)) { | 					if (DeleteTextBufferChar(&_iconsole_cmdline, e->keypress.keycode)) { | ||||||
| 						IConsoleResetHistoryPos(); | 						IConsoleResetHistoryPos(); | ||||||
|   | |||||||
							
								
								
									
										1
									
								
								gui.h
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								gui.h
									
									
									
									
									
								
							| @@ -108,6 +108,7 @@ void HandleEditBox(Window *w, int wid); | |||||||
| int HandleEditBoxKey(Window *w, int wid, WindowEvent *we); | int HandleEditBoxKey(Window *w, int wid, WindowEvent *we); | ||||||
| bool HandleCaret(Textbuf *tb); | bool HandleCaret(Textbuf *tb); | ||||||
|  |  | ||||||
|  | void DeleteTextBufferAll(Textbuf *tb); | ||||||
| bool DeleteTextBufferChar(Textbuf *tb, int delmode); | bool DeleteTextBufferChar(Textbuf *tb, int delmode); | ||||||
| bool InsertTextBufferChar(Textbuf *tb, byte key); | bool InsertTextBufferChar(Textbuf *tb, byte key); | ||||||
| bool InsertTextBufferClipboard(Textbuf *tb); | bool InsertTextBufferClipboard(Textbuf *tb); | ||||||
|   | |||||||
							
								
								
									
										15
									
								
								misc_gui.c
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								misc_gui.c
									
									
									
									
									
								
							| @@ -783,6 +783,17 @@ bool DeleteTextBufferChar(Textbuf *tb, int delmode) | |||||||
| 	return false; | 	return false; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * 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 |  * 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 |  * the screenlength but only about the physical length of the string | ||||||
| @@ -875,6 +886,10 @@ int HandleEditBoxKey(Window *w, int wid, WindowEvent *we) | |||||||
| 		if (InsertTextBufferClipboard(&WP(w, querystr_d).text)) | 		if (InsertTextBufferClipboard(&WP(w, querystr_d).text)) | ||||||
| 			InvalidateWidget(w, wid); | 			InvalidateWidget(w, wid); | ||||||
| 		break; | 		break; | ||||||
|  | 	case (WKC_CTRL | 'U'): | ||||||
|  | 		DeleteTextBufferAll(&WP(w, querystr_d).text); | ||||||
|  | 		InvalidateWidget(w, wid); | ||||||
|  | 		break; | ||||||
| 	case WKC_BACKSPACE: case WKC_DELETE: | 	case WKC_BACKSPACE: case WKC_DELETE: | ||||||
| 		if (DeleteTextBufferChar(&WP(w, querystr_d).text, we->keypress.keycode)) | 		if (DeleteTextBufferChar(&WP(w, querystr_d).text, we->keypress.keycode)) | ||||||
| 			InvalidateWidget(w, wid); | 			InvalidateWidget(w, wid); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Darkvater
					Darkvater