Skip to content

DoDrawComplete should ignore scrolled Viewport.Location when excluding opaque view area #4891

@fubar-coder

Description

@fubar-coder

Describe the bug

When I scroll the content of the "output" TextView, it seems that the "inputFrame" gets moved and its size changed(?) in a strange way, as if parts of the views below is "cleared" (overwritten with blank lines).

To Reproduce

Steps to reproduce the behavior:

  1. Run the following code:
using System.Text;
using Terminal.Gui.App;
using Terminal.Gui.Drawing;
using Terminal.Gui.Drivers;
using Terminal.Gui.ViewBase;
using Terminal.Gui.Views;

using var app = Application.Create().Init();

using Window window = new();

window.BorderStyle = LineStyle.None;
window.Width = Dim.Fill();
window.Height = Dim.Fill();

var inputFrame = new FrameView()
{
    Y = Pos.Align(Alignment.End),
    Width = Dim.Fill(),
    Height = Dim.Auto(DimAutoStyle.Content, Dim.Absolute(3), Dim.Percent(50)),
    BorderStyle = LineStyle.None,
};

var output = new TextView()
{
    Width = Dim.Fill(),
    Height = Dim.Height(window) - Dim.Height(inputFrame) - 1,
};

var input = new TextView()
{
    Height = Dim.Auto(DimAutoStyle.Content, Dim.Absolute(3), Dim.Func(v => (v?.Frame.Height ?? 2) / 2, window)),
    Width = Dim.Fill(),
    WordWrap = true,
};

var outputText = new StringBuilder();

input.KeyDown +=
    (_, key) =>
    {
        // Just a way to add content to the output.
        outputText.Append (key.KeyCode == KeyCode.Enter ? "\n" : key.KeyCode.ToString ());
        output.Text = outputText.ToString ();
        key.Handled = false;
    };

inputFrame.Add(input);
window.Add(inputFrame);

window.Add(output);

app.Run(window);
  1. Expected behavior: (describe what should happen)

Scrolling in the "output" TextView shouldn't affect the views below.

  1. Actual behavior: (describe what actually happens)

It looks like part of the view(s) below the "output" TextView is overwritten with blank lines, almost as if it tries to clear some artifacts for/after scrolling. However, it may instead for some reason modify the Y and Height properties of the "inputFrame". I'm just not sure what happens.

Environment

Please run the following commands in your terminal and paste the output:

OS Information

OS: Microsoft Windows 11 Pro 10.0.26200

Terminal Information

Terminal: Windows Terminal 1.23.20211.0

PowerShell Version

Major  Minor  Patch  PreReleaseLabel BuildLabel
-----  -----  -----  --------------- ----------
7      6      0

.NET Information

10.0.201

.NET SDK:
 Version:           10.0.201
 Commit:            4d3023de60
 Workload version:  10.0.200-manifests.121cc9e6
 MSBuild version:   18.3.0-release-26153-122+4d3023de6

Laufzeitumgebung:
 OS Name:     Windows
 OS Version:  10.0.26200
 OS Platform: Windows
 RID:         win-x64
 Base Path:   C:\Program Files\dotnet\sdk\10.0.201\

Installierte .NET-Workloads:
 [maui-windows]
   Installationsquelle: VS 17.14.37111.16, VS 18.4.11620.152
   Manifestversion:    10.0.20/10.0.100
   Manifestpfad:       C:\Program Files\dotnet\sdk-manifests\10.0.100\microsoft.net.sdk.maui\10.0.20\WorkloadManifest.json
   Installationstyp:              Msi

 [maccatalyst]
   Installationsquelle: VS 17.14.37111.16, VS 18.4.11620.152
   Manifestversion:    26.2.10217/10.0.100
   Manifestpfad:       C:\Program Files\dotnet\sdk-manifests\10.0.100\microsoft.net.sdk.maccatalyst\26.2.10217\WorkloadManifest.json
   Installationstyp:              Msi

 [ios]
   Installationsquelle: VS 17.14.37111.16, VS 18.4.11620.152
   Manifestversion:    26.2.10217/10.0.100
   Manifestpfad:       C:\Program Files\dotnet\sdk-manifests\10.0.100\microsoft.net.sdk.ios\26.2.10217\WorkloadManifest.json
   Installationstyp:              Msi

 [android]
   Installationsquelle: VS 17.14.37111.16, VS 18.4.11620.152
   Manifestversion:    36.1.30/10.0.100
   Manifestpfad:       C:\Program Files\dotnet\sdk-manifests\10.0.100\microsoft.net.sdk.android\36.1.30\WorkloadManifest.json
   Installationstyp:              Msi

Für die Verwendung von workload sets bei der Installation neuer Manifeste konfiguriert.
Es sind keine Workloadsätze installiert. Führen Sie „dotnet workload restore“ aus, um einen Workloadsatz zu installieren.

Host:
  Version:      10.0.5
  Architecture: x64
  Commit:       a612c2a105

.NET SDKs installed:
  6.0.428 [C:\Program Files\dotnet\sdk]
  8.0.411 [C:\Program Files\dotnet\sdk]
  9.0.312 [C:\Program Files\dotnet\sdk]
  10.0.104 [C:\Program Files\dotnet\sdk]
  10.0.201 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 8.0.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 8.0.25 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 9.0.14 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 10.0.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 10.0.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 8.0.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 8.0.25 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 9.0.14 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 10.0.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 10.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 8.0.17 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 8.0.25 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 9.0.14 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 10.0.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 10.0.5 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found:
  x86   [C:\Program Files (x86)\dotnet]
    registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]

Environment variables:
  Not set

global.json file:
  Invalid [C:\Entwicklung\Terminal.Gui\global.json]
    Version '10.0.0' is not valid for the 'sdk/version' value. SDK feature bands start at 1 - for example, 10.0.100

Learn more:
  https://aka.ms/dotnet/info

Download .NET:
  https://aka.ms/dotnet/download

Terminal.Gui Version

Version:

0a87f873917178cb6d92d64724ae6b5432f952de
v2.0.0-beta.1-106-g0a87f8739-dirty

Screenshots, GIFs, or Terminal Output

Image

Additional context

Add any other context about the problem here, such as:

  • Does this happen consistently or intermittently?
  • Did this work in a previous version?
  • Are there any error messages in the console?
  • Terminal configuration or settings that might be relevant?

For Maintainers

Set Project & Milestone: If you have access, please don't forget to set the right Project and Milestone.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    Status

    ✅ Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions