From 1ed6dfcd2eb9878b2ad25c42358d9a21839a1951 Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Sat, 25 Jul 2015 20:07:14 +0200 Subject: Reimplemented `delete` command as more of a `reset` command Pressing `d` in normal mode causes the current embedded terminal to be destroyed and the containing terminal item to be reset into its initial state. This allows for much more flexible usage of _MetaTerm_. To prevent unnecessary terminal item instantiations the `onExecuted` signal was extended to provide a `index` argument containing the sender terminal's index. --- qml/TerminalItem.qml | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'qml/TerminalItem.qml') diff --git a/qml/TerminalItem.qml b/qml/TerminalItem.qml index 0650b1e..26793da 100644 --- a/qml/TerminalItem.qml +++ b/qml/TerminalItem.qml @@ -8,7 +8,7 @@ Item { property int index : 0 property EmbeddedTerminal terminal : null - signal executed + signal executed (int index) anchors { left: parent.left @@ -63,6 +63,19 @@ Item { } } + function reset() { + if ( terminal !== null ) { + terminal.destroy(); + + terminal = null; + command.readOnly = false; + command.focus = true; + + unfocus(); + select(); + } + } + FocusScope { id: scope @@ -146,7 +159,7 @@ Item { focus = false; elementList.createTerminal(text); - item.executed(); + item.executed(item.index); highlighter.deselect(); } } -- cgit v1.2.3