You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by sr...@apache.org on 2022/08/05 13:08:01 UTC

[plc4x] 01/03: feat(plc4xbrowser): hook ctrl-c onto command input clear

This is an automated email from the ASF dual-hosted git repository.

sruehl pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git

commit f2b5ec0dc1d9104a6410bfecdc4cc26fc887d179
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Fri Aug 5 15:01:09 2022 +0200

    feat(plc4xbrowser): hook ctrl-c onto command input clear
---
 plc4go/tools/plc4xbrowser/ui.go | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/plc4go/tools/plc4xbrowser/ui.go b/plc4go/tools/plc4xbrowser/ui.go
index e79c55e52..f6401d32a 100644
--- a/plc4go/tools/plc4xbrowser/ui.go
+++ b/plc4go/tools/plc4xbrowser/ui.go
@@ -61,13 +61,6 @@ func setupApplication() *tview.Application {
 
 	application.SetRoot(grid, true).EnableMouse(true)
 
-	application.SetInputCapture(func(event *tcell.EventKey) *tcell.EventKey {
-		switch event.Key() {
-		case tcell.KeyCtrlC:
-			shutdown()
-		}
-		return event
-	})
 	return application
 }
 
@@ -139,6 +132,14 @@ func buildCommandArea(newPrimitive func(text string) tview.Primitive, applicatio
 		commandInputField := tview.NewInputField().
 			SetLabel("$").
 			SetFieldWidth(30)
+		application.SetInputCapture(func(event *tcell.EventKey) *tcell.EventKey {
+			switch event.Key() {
+			case tcell.KeyCtrlC:
+				commandInputField.SetText("")
+				return nil
+			}
+			return event
+		})
 		commandInputField.
 			SetDoneFunc(func(key tcell.Key) {
 				commandText := commandInputField.GetText()