- added readline alt-d and ^w support (delete till word boundaries)

Mon, 15 Dec 2014 21:36:34 +0200

author
Teemu Piippo <crimsondusk64@gmail.com>
date
Mon, 15 Dec 2014 21:36:34 +0200
changeset 44
693d7751fff0
parent 43
0bc07f54f522
child 45
87b180260a5d

- added readline alt-d and ^w support (delete till word boundaries)

sources/interface.cpp file | annotate | diff | comparison | revisions
--- a/sources/interface.cpp	Mon Dec 15 21:28:24 2014 +0200
+++ b/sources/interface.cpp	Mon Dec 15 21:36:34 2014 +0200
@@ -773,6 +773,19 @@
 		}
 		break;
 
+	case 'W' - 'A' + 1: // readline ^W - delete from previous word bounary to current
+		{
+			int start = interface_find_previous_word();
+
+			if (start != g_cursor)
+			{
+				mutable_current_input().remove (start, g_cursor - start);
+				g_cursor = start;
+				g_needInputRender = true;
+			}
+		}
+		break;
+
 	case '\n':
 	case KEY_ENTER:
 		switch (g_inputState)
@@ -843,6 +856,13 @@
 				g_cursor = interface_find_next_word();
 				g_needInputRender = true;
 				break;
+
+			case 'd':
+			case 'D':
+				// readline alt-d - delete from here till next word boundary
+				mutable_current_input().remove (g_cursor, interface_find_next_word() - g_cursor);
+				g_needInputRender = true;
+				break;
 			}
 		}
 		else

mercurial