Skip to content

Commit

Permalink
feat: Posh.Host.UI.Box.LeftWall ( Fixes #367 )
Browse files Browse the repository at this point in the history
  • Loading branch information
StartAutomating authored and StartAutomating committed Feb 25, 2024
1 parent 11ba04e commit 39b164f
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions Posh.types.ps1xml
Original file line number Diff line number Diff line change
Expand Up @@ -1636,6 +1636,34 @@ if (-not $theseLines) { return }
$theseLines[-1].Substring($theseLines[-1].Length - 1)


</GetScriptBlock>
</ScriptProperty>
<ScriptProperty>
<Name>LeftWall</Name>
<GetScriptBlock>
&lt;#
.SYNOPSIS
Gets a box's Left Wall character
.DESCRIPTION
Gets the Left Wall character in a box.
.NOTES
If the box has a odd number of lines (greater than one),
then the leftmost character above the middle will be considered the wall.
#&gt;
$theseLines = @($this -split '[\r\n]+' -ne '')

if (-not $theseLines) { return }
if ($theseLines.Length -gt 1 -and $theseLines.Length % 2) {
$theLine = $theseLines[[Math]::Floor($theseLines.Length/2) - 1]
$theLine.Substring(0,1)
} else {
$theLine = $theseLines[[Math]::Floor($theseLines.Length/2)]
$theLine.Substring(0,1)
}




</GetScriptBlock>
</ScriptProperty>
<ScriptProperty>
Expand Down

0 comments on commit 39b164f

Please sign in to comment.