added changes to query terminal size

This commit is contained in:
Peter Honeder 2015-07-07 18:05:52 -07:00
parent 0546b02e1c
commit e5e18d5857
3 changed files with 13 additions and 3 deletions

View File

@ -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)

@ -1 +1 @@
Subproject commit f8f4b5e380a222332793c1005d425de02bf1817e
Subproject commit a756ecaadfa486b77032e7cefeb75ac0f479b403

View File

@ -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();
}
/// <summary>
/// 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
/// </summary>
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); }