Show results frame in cyan while scan in progress

This commit is contained in:
Kovid Goyal
2025-07-11 11:05:39 +05:30
parent ecdeea930b
commit 564195f94f
2 changed files with 12 additions and 3 deletions

View File

@@ -268,7 +268,7 @@ func (h *Handler) draw_num_of_matches(num_shown, y int) {
func (h *Handler) draw_results(y, bottom_margin int, matches *SortedResults, in_progress bool) (height int) {
height = h.screen_size.height - y - bottom_margin
h.lp.MoveCursorTo(1, 1+y)
h.draw_frame(h.screen_size.width, height)
h.draw_frame(h.screen_size.width, height, in_progress)
h.lp.MoveCursorTo(1, 1+y)
h.draw_results_title()
y += 2

View File

@@ -12,8 +12,14 @@ import (
var _ = fmt.Print
func (h *Handler) draw_frame(width, height int) {
func (h *Handler) draw_frame(width, height int, in_progress bool) {
lp := h.lp
prefix, suffix := "", ""
if in_progress {
x := h.lp.SprintStyled("fg=cyan", " ")
prefix, suffix, _ = strings.Cut(x, " ")
lp.QueueWriteString(prefix)
}
for i := range height {
lp.SaveCursorPosition()
switch i {
@@ -33,6 +39,9 @@ func (h *Handler) draw_frame(width, height int) {
lp.RestoreCursorPosition()
lp.MoveCursorVertically(1)
}
if suffix != "" {
lp.QueueWriteString(suffix)
}
}
func (h *Handler) draw_search_text(available_width int) {
@@ -93,7 +102,7 @@ func (h *Handler) draw_search_bar(y int) {
left_margin, right_margin := 0, h.draw_controls(y)
h.lp.MoveCursorTo(1+left_margin, 1+y)
available_width := h.screen_size.width - left_margin - right_margin
h.draw_frame(available_width, SEARCH_BAR_HEIGHT)
h.draw_frame(available_width, SEARCH_BAR_HEIGHT, false)
for y1 := y; y1 < y+4; y1++ {
cr := h.state.mouse_state.AddCellRegion("search-bar", left_margin, y1, left_margin+available_width, y1)
cr.PointerShape = loop.TEXT_POINTER