From 1c95e369a88d8b9b13df5df814cf592eb84e2fbc Mon Sep 17 00:00:00 2001 From: Li Haoyi Date: Mon, 2 Dec 2024 11:40:54 +0800 Subject: [PATCH] Re-enable harcdoded prompt sizing for windows (#4059) Was meant to land in https://github.com/com-lihaoyi/mill/pull/4053 but got lost in the merge This hardcoding is just a hack until https://github.com/com-lihaoyi/mill/issues/4055 is resolved --- .../runner/client/MillProcessLauncher.java | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/runner/client/src/mill/runner/client/MillProcessLauncher.java b/runner/client/src/mill/runner/client/MillProcessLauncher.java index 9f36f86a6fec..641b078ebeba 100644 --- a/runner/client/src/mill/runner/client/MillProcessLauncher.java +++ b/runner/client/src/mill/runner/client/MillProcessLauncher.java @@ -213,14 +213,19 @@ static int getTerminalDim(String s, boolean inheritError) throws Exception { static void writeTerminalDims(boolean tputExists, Path serverDir) throws Exception { String str; - if (!tputExists) str = "0 0"; - else { - try { - if (java.lang.System.console() == null) str = "0 0"; - else str = getTerminalDim("cols", true) + " " + getTerminalDim("lines", true); - } catch (Exception e) { - str = "0 0"; + + try { + if (java.lang.System.console() == null) str = "0 0"; + else { + if (!tputExists) { + // Hardcoded size of a quarter screen terminal on 13" windows laptop + str = "78 24"; + } else { + str = getTerminalDim("cols", true) + " " + getTerminalDim("lines", true); + } } + } catch (Exception e) { + str = "0 0"; } Files.write(serverDir.resolve(ServerFiles.terminfo), str.getBytes()); }