aboutsummaryrefslogtreecommitdiff
path: root/qml/TerminalItem.qml
diff options
context:
space:
mode:
authorAdrian Kummerlaender2015-07-25 20:07:14 +0200
committerAdrian Kummerlaender2015-07-25 20:07:14 +0200
commit1ed6dfcd2eb9878b2ad25c42358d9a21839a1951 (patch)
treeaf61cd98c79b768c40a22fb74e4d174ffc999772 /qml/TerminalItem.qml
parent18538591a6226e79e5add5dfc084ab8701e1fd3b (diff)
downloadMetaTerm-1ed6dfcd2eb9878b2ad25c42358d9a21839a1951.tar
MetaTerm-1ed6dfcd2eb9878b2ad25c42358d9a21839a1951.tar.gz
MetaTerm-1ed6dfcd2eb9878b2ad25c42358d9a21839a1951.tar.bz2
MetaTerm-1ed6dfcd2eb9878b2ad25c42358d9a21839a1951.tar.lz
MetaTerm-1ed6dfcd2eb9878b2ad25c42358d9a21839a1951.tar.xz
MetaTerm-1ed6dfcd2eb9878b2ad25c42358d9a21839a1951.tar.zst
MetaTerm-1ed6dfcd2eb9878b2ad25c42358d9a21839a1951.zip
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.
Diffstat (limited to 'qml/TerminalItem.qml')
-rw-r--r--qml/TerminalItem.qml17
1 files changed, 15 insertions, 2 deletions
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();
}
}