diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/im.lua | 12 | ||||
| -rw-r--r-- | src/utils.lua | 6 |
2 files changed, 7 insertions, 11 deletions
@@ -315,11 +315,13 @@ function im.begin_window(title, x, y, w, h, opts) end if mouse_down and focused_win == win then - local last = pop(wins) - wins[win.idx] = last - last.idx = win.idx - table.insert(wins, win) - win.idx = #wins + if wins[#wins] ~= win then + local last = table.remove(wins) + wins[win.idx] = last + last.idx = win.idx + table.insert(wins, win) + win.idx = #wins + end end end diff --git a/src/utils.lua b/src/utils.lua index 33ca7e8..ec5d16e 100644 --- a/src/utils.lua +++ b/src/utils.lua @@ -18,12 +18,6 @@ function min(a, b) return b end -function pop(tbl) - local last = tbl[#tbl] - tbl[#tbl] = nil - return last -end - function normalize(x, y) if x == 0 and y == 0 then return 0, 0 |
