From a73cc7bc2fb11f7099a59eafc73e2161bf807a84 Mon Sep 17 00:00:00 2001 From: iamcheeseman Date: Thu, 12 Mar 2026 15:34:21 -0400 Subject: fix silly lil bug causing mener to cry --- conf.lua | 1 + src/im.lua | 12 +++++++----- src/utils.lua | 6 ------ 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/conf.lua b/conf.lua index db60d1a..fee725d 100644 --- a/conf.lua +++ b/conf.lua @@ -2,4 +2,5 @@ function love.conf(t) t.window.title = "Gutshot" t.window.width = 320 * 3 t.window.height = 180 * 3 + t.window.vsync = 0 end diff --git a/src/im.lua b/src/im.lua index 28c7064..7602765 100644 --- a/src/im.lua +++ b/src/im.lua @@ -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 -- cgit v1.3-2-g0d8e