From 1bf42f883ad6c68ebc48c2b574233fb0fb27aecf Mon Sep 17 00:00:00 2001 From: ruki Date: Tue, 2 Jan 2018 00:27:55 +0800 Subject: fix cursor bug --- xmake/core/ui/program.lua | 5 ++++- xmake/core/ui/view.lua | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/xmake/core/ui/program.lua b/xmake/core/ui/program.lua index d8a5664a4..765d95732 100644 --- a/xmake/core/ui/program.lua +++ b/xmake/core/ui/program.lua @@ -380,7 +380,7 @@ function program:_refresh_cursor() end -- get the cursor position - local cursor = focused_view and focused_view:cursor() or point{0, 0} + local cursor = focused_view and focused_view:cursor()() or point{0, 0} if cursor_state ~= 0 then local v = focused_view while v:parent() do @@ -405,6 +405,9 @@ function program:_refresh_cursor() -- get main window local main_window = curses.main_window() + -- trace + log:print("cursor(%s): %s, %d", focused_view, cursor, cursor_state) + -- move cursor position if cursor_state ~= 0 then main_window:move(cursor.y, cursor.x) diff --git a/xmake/core/ui/view.lua b/xmake/core/ui/view.lua index d7d11ee06..701e3f95b 100644 --- a/xmake/core/ui/view.lua +++ b/xmake/core/ui/view.lua @@ -80,7 +80,7 @@ function view:init(name, bounds) self._NAME = name -- init cursor - self._CURSOR = point {0, 0} + self._CURSOR = point{0, 0} -- init bounds and window self:bounds_set(bounds) -- cgit v1.3.1