diff options
author | Ali Mohammad Pur <ali.mpfard@gmail.com> | 2021-06-19 03:53:03 +0430 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-06-23 19:04:08 +0200 |
commit | 2f2b7814d15c9030f6794c5e844545104421778d (patch) | |
tree | 83a6df31f02a409d096b29250a11b32bc9c6fce7 /Userland/Libraries/LibVT/Position.h | |
parent | 424965954f88bbac0516529ee984f7a2276a139e (diff) | |
download | serenity-2f2b7814d15c9030f6794c5e844545104421778d.zip |
LibVT+Terminal: Implement line wrapping
This commit implements line wrapping in the terminal, and tries its best
to move the cursor to the "correct" position.
Diffstat (limited to 'Userland/Libraries/LibVT/Position.h')
-rw-r--r-- | Userland/Libraries/LibVT/Position.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Userland/Libraries/LibVT/Position.h b/Userland/Libraries/LibVT/Position.h index 13a8e5b4b7..90b6d724aa 100644 --- a/Userland/Libraries/LibVT/Position.h +++ b/Userland/Libraries/LibVT/Position.h @@ -51,4 +51,15 @@ private: int m_column { -1 }; }; +struct CursorPosition { + u16 row { 0 }; + u16 column { 0 }; + + void clamp(u16 max_row, u16 max_column) + { + row = min(row, max_row); + column = min(column, max_column); + } +}; + } |