diff --git a/scripts/powershell-run.mk b/scripts/powershell-run.mk index 31cca1edd4..e7cb5c9260 100644 --- a/scripts/powershell-run.mk +++ b/scripts/powershell-run.mk @@ -11,7 +11,7 @@ POWERSHELL_RUN_SRCS=$(addprefix $(POWERSHELL_RUN_FOLDER)/, main.cs host.cs ui.cs POWERSHELL_RUN_DEPS=dotnetlibs/System.Management.Automation.dll dotnetlibs/Microsoft.PowerShell.Commands.Management.dll dotnetlibs/$(ASSEMBLY_LOAD_CONTEXT_TARGET) POWERSHELL_RUN_REFS=$(addprefix -r:,$(POWERSHELL_RUN_DEPS)) -POWERSHELL_RUN_TARGETS=dotnetlibs/powershell-run.exe dotnetlibs/powershell-simple.exe +POWERSHELL_RUN_TARGETS=dotnetlibs/powershell-run.exe dotnetlibs/powershell-simple.exe dotnetlibs/libps.so dotnetlibs/powershell-run.exe: $(POWERSHELL_RUN_SRCS) $(POWERSHELL_RUN_DEPS) $(CSC) -out:$@ -noconfig -nostdlib -target:exe $(POWERSHELL_RUN_REFS) $(COREREF) $(POWERSHELL_RUN_SRCS) diff --git a/src/monad-native b/src/monad-native index f8f4b5e380..a756ecaadf 160000 --- a/src/monad-native +++ b/src/monad-native @@ -1 +1 @@ -Subproject commit f8f4b5e380a222332793c1005d425de02bf1817e +Subproject commit a756ecaadfa486b77032e7cefeb75ac0f479b403 diff --git a/src/powershell-run/rawui.cs b/src/powershell-run/rawui.cs index 97d93e5bc3..501812ff24 100644 --- a/src/powershell-run/rawui.cs +++ b/src/powershell-run/rawui.cs @@ -8,6 +8,7 @@ using System.Management.Automation.Runspaces; using System.Management.Automation.Host; using System.Globalization; using System.Reflection; +using System.Runtime.InteropServices; namespace Microsoft.Samples.PowerShell.Host { @@ -15,6 +16,15 @@ namespace Microsoft.Samples.PowerShell.Host internal class MyRawUserInterface : PSHostRawUserInterface { + // this class provides features otherwise not available through .net + internal class Native + { + [DllImport("libps")] + internal static extern int GetTerminalWidth(); + [DllImport("libps")] + internal static extern int GetTerminalHeight(); + } + /// /// Gets or sets the background color of the displayed text. /// This maps to the corresponding Console.Background property. @@ -31,7 +41,7 @@ namespace Microsoft.Samples.PowerShell.Host /// public override Size BufferSize { - get { return new Size(200,500); } + get { return new Size(Native.GetTerminalWidth()-1,Native.GetTerminalHeight()-1); } set { } //get { return new Size(Console.BufferWidth, Console.BufferHeight); } //set { Console.SetBufferSize(value.Width, value.Height); }