Skip to content

Commit 5cfb0c7

Browse files
committed
Stop hiding on scroll
1 parent 4b5be79 commit 5cfb0c7

1 file changed

Lines changed: 11 additions & 15 deletions

File tree

plugins/lua/orders.lua

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -715,7 +715,6 @@ end
715715
--
716716

717717
local search_cursor_visible = false
718-
local search_last_scroll_position = -1
719718
local order_count_at_highlight = 0
720719
local search_matched_indices = {}
721720
local search_current_match_idx = 0
@@ -820,7 +819,13 @@ end
820819
function OrdersSearchOverlay:update_filter(text)
821820
search_matched_indices = perform_search(text)
822821
search_current_match_idx = 0
823-
search_cursor_visible = false
822+
823+
if #search_matched_indices > 0 then
824+
search_cursor_visible = true
825+
order_count_at_highlight = #df.global.world.manager_orders.all
826+
else
827+
search_cursor_visible = false
828+
end
824829

825830
if text == '' then
826831
self.subviews.main_panel.frame_title = 'Search'
@@ -866,7 +871,6 @@ function OrdersSearchOverlay:cycle_match(direction)
866871
-- Scroll to the selected match
867872
local order_idx = search_matched_indices[search_current_match_idx]
868873
mi.info.work_orders.scroll_position_work_orders = order_idx
869-
search_last_scroll_position = order_idx
870874
search_cursor_visible = true
871875
order_count_at_highlight = #df.global.world.manager_orders.all
872876

@@ -1020,16 +1024,8 @@ function OrderHighlightOverlay:render(dc)
10201024

10211025
if mi.job_details.open or not search_cursor_visible then return end
10221026

1023-
local current_scroll = mi.info.work_orders.scroll_position_work_orders
1024-
local current_order_count = #df.global.world.manager_orders.all
1025-
1026-
-- Hide cursor when user manually scrolls
1027-
if search_last_scroll_position ~= -1 and current_scroll ~= search_last_scroll_position then
1028-
search_cursor_visible = false
1029-
return
1030-
end
1031-
10321027
-- Hide cursor when order list changes (orders added or removed)
1028+
local current_order_count = #df.global.world.manager_orders.all
10331029
if order_count_at_highlight ~= current_order_count then
10341030
search_cursor_visible = false
10351031
return
@@ -1040,13 +1036,13 @@ function OrderHighlightOverlay:render(dc)
10401036

10411037
local selected_pen = dfhack.pen.parse{
10421038
fg=COLOR_BLACK,
1043-
bg=COLOR_RED,
1039+
bg=COLOR_WHITE,
10441040
bold=true,
10451041
}
10461042

10471043
local match_pen = dfhack.pen.parse{
1048-
fg=COLOR_BLACK,
1049-
bg=COLOR_WHITE,
1044+
fg=COLOR_WHITE,
1045+
bg=COLOR_BLACK,
10501046
bold=true,
10511047
}
10521048

0 commit comments

Comments
 (0)