浏览代码

LineEdit/TextEdit: Add Shift+Delete shortcut for cut

Ignacio Etcheverry 9 年之前
父节点
当前提交
fac027cb14
共有 2 个文件被更改,包括 11 次插入0 次删除
  1. 5 0
      scene/gui/line_edit.cpp
  2. 6 0
      scene/gui/text_edit.cpp

+ 5 - 0
scene/gui/line_edit.cpp

@@ -274,6 +274,11 @@ void LineEdit::_input_event(InputEvent p_event) {
 					} break;
 					} break;
 					case KEY_DELETE: {
 					case KEY_DELETE: {
 
 
+						if (k.mod.shift && !k.mod.command && !k.mod.alt && editable) {
+							cut_text();
+							break;
+						}
+
 						if (editable) {
 						if (editable) {
 							undo_text = text;
 							undo_text = text;
 							if (selection.enabled)
 							if (selection.enabled)

+ 6 - 0
scene/gui/text_edit.cpp

@@ -1957,6 +1957,12 @@ void TextEdit::_input_event(const InputEvent& p_input_event) {
 
 
 					if (readonly)
 					if (readonly)
 						break;
 						break;
+
+					if (k.mod.shift && !k.mod.command && !k.mod.alt) {
+						cut();
+						break;
+					}
+
 					int curline_len = text[cursor.line].length();
 					int curline_len = text[cursor.line].length();
 
 
 					if (cursor.line==text.size()-1 && cursor.column==curline_len)
 					if (cursor.line==text.size()-1 && cursor.column==curline_len)