From 49edb32662e20c284e4a0a1a5b248eb65f2b42b6 Mon Sep 17 00:00:00 2001
From: Adrian Kummerlaender
Date: Mon, 31 Aug 2015 19:18:19 +0200
Subject: Adapt focus and input scoping to respect history viewer

---
 src/list/TerminalItem.qml | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

(limited to 'src')

diff --git a/src/list/TerminalItem.qml b/src/list/TerminalItem.qml
index 9a1b758..7de2b48 100644
--- a/src/list/TerminalItem.qml
+++ b/src/list/TerminalItem.qml
@@ -38,6 +38,7 @@ Item {
 		scope.forceActiveFocus();
 
 		if ( terminal === null ) {
+			command.readOnly = false;
 			highlighter.select();
 			highlighter.focus();
 		}
@@ -45,6 +46,7 @@ Item {
 
 	function unfocus() {
 		if ( terminal === null ) {
+			command.readOnly = true;
 			highlighter.unfocus();
 		}
 	}
@@ -68,14 +70,15 @@ Item {
 	function reset() {
 		if ( terminal !== null ) {
 			terminal.destroy();
-
-			terminal         = null;
-			command.readOnly = false;
-			command.focus    = true;
-
-			mode.enterNormalMode();
-			unfocus();
+			terminal = null;
+		} else if ( history !== null ) {
+			history.destroy();
+			history = null;
 		}
+
+		command.focus = true;
+		mode.enterNormalMode();
+		unfocus();
 	}
 
 	FocusScope {
@@ -172,7 +175,7 @@ Item {
 					Layout.fillWidth: true
 
 					onAccepted: {
-						if ( item.terminal === null ) {
+						if ( !readOnly ) {
 							readOnly = true;
 							focus    = false;
 
-- 
cgit v1.2.3