diff --git a/kde/gui/ChatBlockDelegate.qml b/kde/gui/ChatBlockDelegate.qml index 0d4c064..ee34501 100644 --- a/kde/gui/ChatBlockDelegate.qml +++ b/kde/gui/ChatBlockDelegate.qml @@ -253,7 +253,7 @@ Column { // B3: Plumb selection (no context menu) var sel = mainTextEdit.selectedText if (sel && sel.trim() !== "" && plumber.available()) { - plumber.plumb(sel.trim()) + plumber.plumb(sel.trim(), sessionCwd()) } mouse.accepted = true } @@ -332,6 +332,13 @@ Column { return false } + // Get current session's working directory for plumb basedir + function sessionCwd() { + if (!ollie.activeSessionId) return "" + var cfg = ollie.readSessionConfig(ollie.activeSessionId) + return cfg ? (cfg.cwd || "") : "" + } + // Text segment component Component { id: textComponent @@ -392,7 +399,7 @@ Column { // B3: Plumb selection (no context menu) var sel = textEdit.selectedText if (sel && sel.trim() !== "" && plumber.available()) { - plumber.plumb(sel.trim()) + plumber.plumb(sel.trim(), sessionCwd()) } mouse.accepted = true } @@ -501,7 +508,7 @@ Column { // B3: Plumb selection (no context menu) var sel = sourceEdit.selectedText if (sel && sel.trim() !== "" && plumber.available()) { - plumber.plumb(sel.trim()) + plumber.plumb(sel.trim(), sessionCwd()) } mouse.accepted = true } diff --git a/kde/gui/ChatPane.qml b/kde/gui/ChatPane.qml index 9379045..474769d 100644 --- a/kde/gui/ChatPane.qml +++ b/kde/gui/ChatPane.qml @@ -37,6 +37,13 @@ Item { scrollToBottom() } + // Get current session's working directory for plumb basedir + function sessionCwd() { + if (!ollie.activeSessionId) return "" + var cfg = ollie.readSessionConfig(ollie.activeSessionId) + return cfg ? (cfg.cwd || "") : "" + } + Component.onCompleted: { loadChat() scrollToBottom() @@ -499,7 +506,7 @@ Item { // B3: Plumb selection (no context menu) var sel = promptInput.selectedText if (sel && sel.trim() !== "" && plumber.available()) { - plumber.plumb(sel.trim()) + plumber.plumb(sel.trim(), sessionCwd()) } } } diff --git a/kde/gui/plumber.h b/kde/gui/plumber.h index 99372f2..e0611cc 100644 --- a/kde/gui/plumber.h +++ b/kde/gui/plumber.h @@ -56,8 +56,8 @@ public: Q_INVOKABLE bool available() const; // Legacy compatibility aliases - Q_INVOKABLE void plumb(const QString &text) { send(text); } - Q_INVOKABLE void plumbTo(const QString &text, const QString &dst) { sendTo(text, dst); } + Q_INVOKABLE void plumb(const QString &text, const QString &wdir = QString()) { send(text, wdir); } + Q_INVOKABLE void plumbTo(const QString &text, const QString &dst, const QString &wdir = QString()) { sendTo(text, dst, wdir); } /*! * Start the edit-port reader thread. Safe to call once; further calls are