From c408465549d23b2097867baff2ea038e991eea40 Mon Sep 17 00:00:00 2001 From: Ellie Huxtable Date: Thu, 25 Jul 2024 16:08:53 +0100 Subject: fix(gui): double return on mac/linux (#2311) --- ui/src/components/runbooks/editor/blocks/RunBlock/index.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'ui/src/components') diff --git a/ui/src/components/runbooks/editor/blocks/RunBlock/index.tsx b/ui/src/components/runbooks/editor/blocks/RunBlock/index.tsx index b3a96166..25faa211 100644 --- a/ui/src/components/runbooks/editor/blocks/RunBlock/index.tsx +++ b/ui/src/components/runbooks/editor/blocks/RunBlock/index.tsx @@ -10,6 +10,7 @@ import { Play, Square } from "lucide-react"; import { useState } from "react"; import { extensions } from "./extensions"; +import { platform } from "@tauri-apps/plugin-os"; import { invoke } from "@tauri-apps/api/core"; import Terminal from "./terminal.tsx"; @@ -72,7 +73,10 @@ const RunBlock = ({ if (currentRunbook) incRunbookPty(currentRunbook); - let val = !value.endsWith("\n") ? value + "\r\n" : value; + let isWindows = platform() == "windows"; + let cmdEnd = isWindows ? "\r\n" : "\n"; + + let val = !value.endsWith("\n") ? value + cmdEnd : value; await invoke("pty_write", { pid: pty, data: val }); } }; -- cgit v1.3.1