Skip to content

View drawing APIs should restrict drawing to Viewport #3302

@tig

Description

@tig

This is mostly fixed in #3323.

What won't be addressed there is:

  • ConsoleDriver.Move should not be public and should only be called by View.Move.
  • It should not be possible for a View to change Driver.Clip.
  • Driver.ClearContents sets Clip to Screen. This is dangerous. Either move the Clip = elsewhere or restrict who can call ClearContents
  • Driver.AddStr has bugs in it related to Clip; there are codepaths where Contents's bounds are exceeded even when IsValidLocation is true.
  • Views and Scenarios that use Driver. anywhere should be updated to use the equivalent View API. IOW, we should remove as much coupling between View and Driver as possible

Already adressed:

  • View.Clear - I've already done this for Clear in BoundsToScreen is confusing #3298
  • View.Move - Before the call to Driver.Move, ensure coords are w/in Bounds
  • View.SetNeedsDisplay

Additionally: We should make Driver.AddRune/AddStr/Move internal and change all built-in views that use these APIs use View.AddRune/AddStr/Move instead

These are all causes of confusion and potential bugs.

I'm not a fan of letting views draw in arbitrary places. If there's use case for a view drawing outside of it's bounds (once Adornments is finished), please let me know!

Metadata

Metadata

Assignees

No one assigned

    Labels

    designIssues regarding Terminal.Gui design (bugs, guidelines, debates, etc...)

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions