Skip to content

Commit

Permalink
Get buffer/viewport dimensions through Page object.
Browse files Browse the repository at this point in the history
  • Loading branch information
j4james committed Jan 28, 2024
1 parent c82ca50 commit 5858773
Show file tree
Hide file tree
Showing 3 changed files with 185 additions and 179 deletions.
35 changes: 35 additions & 0 deletions src/terminal/adapter/PageManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,41 @@ void Page::SetAttributes(const TextAttribute& attr, ITerminalApi* api) const
}
}

til::CoordType Page::Top() const noexcept
{
return _viewport.top;
}

til::CoordType Page::Bottom() const noexcept
{
return _viewport.bottom;
}

til::CoordType Page::Width() const noexcept
{
return _buffer.GetSize().Width();
}

til::CoordType Page::Height() const noexcept
{
return _viewport.bottom - _viewport.top;
}

til::CoordType Page::BufferHeight() const noexcept
{
return _buffer.GetSize().Height();
}

til::CoordType Page::XPanOffset() const noexcept
{
return _viewport.left;
}

til::CoordType Page::YPanOffset() const noexcept
{
return 0; // Vertical panning is not yet supported
}

PageManager::PageManager(ITerminalApi& api, Renderer& renderer) noexcept :
_api{ api },
_renderer{ renderer }
Expand Down
7 changes: 7 additions & 0 deletions src/terminal/adapter/PageManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ namespace Microsoft::Console::VirtualTerminal
Cursor& Cursor() const noexcept;
const TextAttribute& Attributes() const noexcept;
void SetAttributes(const TextAttribute& attr, ITerminalApi* api = nullptr) const;
til::CoordType Top() const noexcept;
til::CoordType Bottom() const noexcept;
til::CoordType Width() const noexcept;
til::CoordType Height() const noexcept;
til::CoordType BufferHeight() const noexcept;
til::CoordType XPanOffset() const noexcept;
til::CoordType YPanOffset() const noexcept;

private:
TextBuffer& _buffer;
Expand Down
Loading

1 comment on commit 5858773

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@check-spelling-bot Report

🔴 Please review

See the 📜action log or 📝 job summary for details.

Unrecognized words (5)

DECPCCM
DECRQDE
potentail
XPan
YPan

Previously acknowledged words that are now absent DESTINATIONNAME 🫥
To accept these unrecognized words as correct and remove the previously acknowledged and now absent words, you could run the following commands

... in a clone of the [email protected]:j4james/terminal.git repository
on the feature-paging branch (ℹ️ how do I use this?):

curl -s -S -L 'https://raw.githubusercontent.com/check-spelling/check-spelling/v0.0.22/apply.pl' |
perl - 'https://github.com/j4james/terminal/actions/runs/7685638986/attempts/1'
Available 📚 dictionaries could cover words (expected and unrecognized) not in the 📘 dictionary

This includes both expected items (2237) from .github/actions/spelling/expect/04cdb9b77d6827c0202f51acd4205b017015bfff.txt
.github/actions/spelling/expect/alphabet.txt
.github/actions/spelling/expect/expect.txt
.github/actions/spelling/expect/web.txt and unrecognized words (5)

Dictionary Entries Covers Uniquely
cspell:k8s/dict/k8s.txt 153 2 2
cspell:swift/src/swift.txt 53 1 1
cspell:gaming-terms/dict/gaming-terms.txt 59 1 1
cspell:monkeyc/src/monkeyc_keywords.txt 123 1 1
cspell:cryptocurrencies/cryptocurrencies.txt 125 1 1

Consider adding them (in .github/workflows/spelling2.yml) for uses: check-spelling/[email protected] in its with:

      with:
        extra_dictionaries:
          cspell:k8s/dict/k8s.txt
          cspell:swift/src/swift.txt
          cspell:gaming-terms/dict/gaming-terms.txt
          cspell:monkeyc/src/monkeyc_keywords.txt
          cspell:cryptocurrencies/cryptocurrencies.txt

To stop checking additional dictionaries, add (in .github/workflows/spelling2.yml) for uses: check-spelling/[email protected] in its with:

check_extra_dictionaries: ''
Errors (1)

See the 📜action log or 📝 job summary for details.

❌ Errors Count
❌ ignored-expect-variant 3

See ❌ Event descriptions for more information.

✏️ Contributor please read this

By default the command suggestion will generate a file named based on your commit. That's generally ok as long as you add the file to your commit. Someone can reorganize it later.

If the listed items are:

  • ... misspelled, then please correct them instead of using the command.
  • ... names, please add them to .github/actions/spelling/allow/names.txt.
  • ... APIs, you can add them to a file in .github/actions/spelling/allow/.
  • ... just things you're using, please add them to an appropriate file in .github/actions/spelling/expect/.
  • ... tokens you only need in one place and shouldn't generally be used, you can add an item in an appropriate file in .github/actions/spelling/patterns/.

See the README.md in each directory for more information.

🔬 You can test your commits without appending to a PR by creating a new branch with that extra change and pushing it to your fork. The check-spelling action will run in response to your push -- it doesn't require an open pull request. By using such a branch, you can limit the number of typos your peers see you make. 😉

If the flagged items are 🤯 false positives

If items relate to a ...

  • binary file (or some other file you wouldn't want to check at all).

    Please add a file path to the excludes.txt file matching the containing file.

    File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.

    ^ refers to the file's path from the root of the repository, so ^README\.md$ would exclude README.md (on whichever branch you're using).

  • well-formed pattern.

    If you can write a pattern that would match it,
    try adding it to the patterns.txt file.

    Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.

    Note that patterns can't match multiline strings.

Please sign in to comment.