Skip to content

Commit

Permalink
Allow starting selections from padding area
Browse files Browse the repository at this point in the history
  • Loading branch information
carlos-zamora committed Jun 3, 2020
1 parent 413b658 commit fceab19
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/cascadia/TerminalControl/TermControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2283,7 +2283,7 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation
}

// Account for the size of any padding
const auto padding = SwapChainPanel().Margin();
const auto padding = GetPadding();
width += padding.Left + padding.Right;
height += padding.Top + padding.Bottom;

Expand All @@ -2303,7 +2303,7 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation
const auto fontSize = _actualFont.GetSize();
const auto fontDimension = widthOrHeight ? fontSize.X : fontSize.Y;

const auto padding = SwapChainPanel().Margin();
const auto padding = GetPadding();
auto nonTerminalArea = gsl::narrow_cast<float>(widthOrHeight ?
padding.Left + padding.Right :
padding.Top + padding.Bottom);
Expand Down Expand Up @@ -2435,7 +2435,7 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation
{
// cursorPosition is DIPs, relative to SwapChainPanel origin
const til::point cursorPosInDIPs{ til::math::rounding, cursorPosition };
const til::size marginsInDips{ til::math::rounding, SwapChainPanel().Margin().Left, SwapChainPanel().Margin().Top };
const til::size marginsInDips{ til::math::rounding, GetPadding().Left, GetPadding().Top };

// This point is the location of the cursor within the actual grid of characters, in DIPs
const til::point relativeToMarginInDIPs = cursorPosInDIPs - marginsInDips;
Expand Down
14 changes: 9 additions & 5 deletions src/cascadia/TerminalControl/TermControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,17 @@
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>

<Grid Grid.Column="0">
<Grid x:Name="TerminalArea"
Grid.Column="0"
Visibility="Visible"
Background="Transparent"
PointerPressed="_PointerPressedHandler"
PointerMoved="_PointerMovedHandler"
PointerReleased="_PointerReleasedHandler">

<SwapChainPanel x:Name="SwapChainPanel"
SizeChanged="_SwapChainSizeChanged"
CompositionScaleChanged="_SwapChainScaleChanged"
PointerPressed="_PointerPressedHandler"
PointerMoved="_PointerMovedHandler"
PointerReleased="_PointerReleasedHandler" />
CompositionScaleChanged="_SwapChainScaleChanged" />

<!-- Putting this in a grid w/ the SwapChainPanel
ensures that it's always aligned w/ the scrollbar -->
Expand Down

0 comments on commit fceab19

Please sign in to comment.