Skip to content

Commit

Permalink
ui/Window: add method GetCursor()
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxKellermann committed Sep 6, 2024
1 parent 1fdc8a6 commit 65d617e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/ui/Window.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ struct Window {
return size;
}

[[gnu::pure]]
const Point GetCursor() const noexcept {
Point p;
getyx(w, p.y, p.x);
return p;
}

[[gnu::pure]]
unsigned GetWidth() const noexcept {
return getmaxx(w);
Expand Down
2 changes: 1 addition & 1 deletion src/wreadln.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ _wreadln(const Window window,
/* make sure the cursor is visible */
curs_set(1);
/* retrieve y and x0 position */
getyx(window.w, wr.point.y, wr.point.x);
wr.point = window.GetCursor();
/* check the x1 value */
if (x1 <= (unsigned)wr.point.x || x1 > (unsigned)COLS)
x1 = COLS;
Expand Down

0 comments on commit 65d617e

Please sign in to comment.