mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2026-01-01 16:59:35 +01:00
* Fixes #2717. Label not display fully when resizing terminal. * Fixes #2719. View Move and ViewToScreen shouldn't use Clipped parameter as true by default but only for cursor. * Fixes #2720. TextFormatter.Draw shouldn't set the Driver.Clip. * Add braces. --------- Co-authored-by: Tig <tig@users.noreply.github.com>
This commit is contained in:
@@ -1176,24 +1176,35 @@ namespace Terminal.Gui {
|
||||
}
|
||||
|
||||
var isVertical = IsVerticalDirection (textDirection);
|
||||
var savedClip = Application.Driver?.Clip;
|
||||
var maxBounds = bounds;
|
||||
if (Application.Driver != null) {
|
||||
Application.Driver.Clip = maxBounds = containerBounds == default
|
||||
? bounds
|
||||
: new Rect (Math.Max (containerBounds.X, bounds.X),
|
||||
var maxBounds = containerBounds == default
|
||||
? bounds
|
||||
: new Rect (Math.Max (containerBounds.X, bounds.X),
|
||||
Math.Max (containerBounds.Y, bounds.Y),
|
||||
Math.Max (Math.Min (containerBounds.Width, containerBounds.Right - bounds.Left), 0),
|
||||
Math.Max (Math.Min (containerBounds.Height, containerBounds.Bottom - bounds.Top), 0));
|
||||
Math.Max (Math.Max (containerBounds.Width, containerBounds.Right - bounds.Left), 0),
|
||||
Math.Max (Math.Max (containerBounds.Height, containerBounds.Bottom - bounds.Top), 0));
|
||||
|
||||
int boundsStart = 0;
|
||||
if (isVertical) {
|
||||
if (bounds.X < 0) {
|
||||
boundsStart = bounds.X;
|
||||
}
|
||||
} else {
|
||||
if (bounds.Y < 0) {
|
||||
boundsStart = bounds.Y;
|
||||
}
|
||||
}
|
||||
|
||||
for (int line = 0; line < linesFormated.Count; line++) {
|
||||
if ((isVertical && line > bounds.Width) || (!isVertical && line > bounds.Height))
|
||||
if (boundsStart < 0) {
|
||||
boundsStart++;
|
||||
continue;
|
||||
}
|
||||
if ((isVertical && line > bounds.Width) || (!isVertical && line > bounds.Height)) {
|
||||
continue;
|
||||
}
|
||||
if ((isVertical && line >= maxBounds.Left + maxBounds.Width)
|
||||
|| (!isVertical && line >= maxBounds.Top + maxBounds.Height))
|
||||
|
||||
|| (!isVertical && line >= maxBounds.Top + maxBounds.Height)) {
|
||||
break;
|
||||
}
|
||||
|
||||
var runes = lines [line].ToRunes ();
|
||||
|
||||
@@ -1278,8 +1289,9 @@ namespace Terminal.Gui {
|
||||
} else if (!fillRemaining && idx > runes.Length - 1) {
|
||||
break;
|
||||
}
|
||||
if ((!isVertical && idx > maxBounds.Left + maxBounds.Width - bounds.X) || (isVertical && idx > maxBounds.Top + maxBounds.Height - bounds.Y))
|
||||
if ((!isVertical && idx >= maxBounds.Left + maxBounds.Width - bounds.X) || (isVertical && idx >= maxBounds.Top + maxBounds.Height - bounds.Y)) {
|
||||
break;
|
||||
}
|
||||
|
||||
var rune = (Rune)' ';
|
||||
if (isVertical) {
|
||||
@@ -1316,8 +1328,6 @@ namespace Terminal.Gui {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Application.Driver != null)
|
||||
Application.Driver.Clip = (Rect)savedClip;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1128,7 +1128,7 @@ namespace Terminal.Gui {
|
||||
/// <param name="rcol">Absolute column; screen-relative.</param>
|
||||
/// <param name="rrow">Absolute row; screen-relative.</param>
|
||||
/// <param name="clipped">Whether to clip the result of the ViewToScreen method, if set to <see langword="true"/>, the rcol, rrow values are clamped to the screen (terminal) dimensions (0..TerminalDim-1).</param>
|
||||
internal void ViewToScreen (int col, int row, out int rcol, out int rrow, bool clipped = true)
|
||||
internal void ViewToScreen (int col, int row, out int rcol, out int rrow, bool clipped = false)
|
||||
{
|
||||
// Computes the real row, col relative to the screen.
|
||||
rrow = row + frame.Y;
|
||||
@@ -1268,7 +1268,7 @@ namespace Terminal.Gui {
|
||||
/// <param name="row">Row.</param>
|
||||
/// <param name="clipped">Whether to clip the result of the ViewToScreen method,
|
||||
/// if set to <see langword="true"/>, the col, row values are clamped to the screen (terminal) dimensions (0..TerminalDim-1).</param>
|
||||
public void Move (int col, int row, bool clipped = true)
|
||||
public void Move (int col, int row, bool clipped = false)
|
||||
{
|
||||
if (Driver.Rows == 0) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user