715715--
716716
717717local search_cursor_visible = false
718- local search_last_scroll_position = - 1
719718local order_count_at_highlight = 0
720719local search_matched_indices = {}
721720local search_current_match_idx = 0
820819function 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