diff --git a/src/ui/Window.hxx b/src/ui/Window.hxx index 5d8b34ee..4cee902e 100644 --- a/src/ui/Window.hxx +++ b/src/ui/Window.hxx @@ -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); diff --git a/src/wreadln.cxx b/src/wreadln.cxx index 5820e21c..ddda3143 100644 --- a/src/wreadln.cxx +++ b/src/wreadln.cxx @@ -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;