From 1e0c7d05059a1016882031cd9af4487741ac3030 Mon Sep 17 00:00:00 2001 From: Christopher Schnick Date: Fri, 16 Dec 2022 19:49:40 +0100 Subject: [PATCH] Small fixes relating to shells --- .../io/xpipe/core/process/CommandProcessControl.java | 2 ++ .../io/xpipe/extension/fxcomps/impl/TextAreaComp.java | 11 ++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/io/xpipe/core/process/CommandProcessControl.java b/core/src/main/java/io/xpipe/core/process/CommandProcessControl.java index 0fa32e01a..83df9e65d 100644 --- a/core/src/main/java/io/xpipe/core/process/CommandProcessControl.java +++ b/core/src/main/java/io/xpipe/core/process/CommandProcessControl.java @@ -7,6 +7,8 @@ import java.util.function.Consumer; public interface CommandProcessControl extends ProcessControl { + CommandProcessControl complex(); + default InputStream startExternalStdout() throws Exception { try { start(); diff --git a/extension/src/main/java/io/xpipe/extension/fxcomps/impl/TextAreaComp.java b/extension/src/main/java/io/xpipe/extension/fxcomps/impl/TextAreaComp.java index 72e597ae2..bf64422bd 100644 --- a/extension/src/main/java/io/xpipe/extension/fxcomps/impl/TextAreaComp.java +++ b/extension/src/main/java/io/xpipe/extension/fxcomps/impl/TextAreaComp.java @@ -2,6 +2,7 @@ package io.xpipe.extension.fxcomps.impl; import io.xpipe.extension.fxcomps.SimpleComp; import io.xpipe.extension.fxcomps.util.PlatformThread; +import io.xpipe.extension.fxcomps.util.SimpleChangeListener; import javafx.beans.binding.Bindings; import javafx.beans.property.Property; import javafx.beans.property.SimpleStringProperty; @@ -14,7 +15,7 @@ import java.util.Objects; public class TextAreaComp extends SimpleComp { private final Property value; - private final Property lazyValue = new SimpleStringProperty(); + private final Property lazyValue; private final boolean lazy; public TextAreaComp(Property value) { @@ -22,16 +23,20 @@ public class TextAreaComp extends SimpleComp { } public TextAreaComp(Property value, boolean lazy) { - this.value = value; + this.lazyValue = value; + this.value = new SimpleStringProperty(value.getValue()); this.lazy = lazy; if (!lazy) { - value.bind(lazyValue); + SimpleChangeListener.apply(value, val -> { + value.setValue(val); + }); } } @Override protected Region createSimple() { var text = new TextArea(value.getValue() != null ? value.getValue() : null); + text.setPrefRowCount(5); text.textProperty().addListener((c, o, n) -> { lazyValue.setValue(n != null && n.length() > 0 ? n : null); });