@@ -54,11 +54,25 @@ func (h *Handler) draw_no_matches_message(in_progress bool) {
5454
5555}
5656
57+ const matching_position_style = "fg=green"
58+
5759func (h * Handler ) draw_matching_result (r ResultItem ) {
60+ icon := icon_for (r .abspath , r .dir_entry )
61+ h .lp .MoveCursorHorizontally (1 )
62+ p , s , _ := strings .Cut (h .lp .SprintStyled (matching_position_style , " " ), " " )
63+ h .lp .QueueWriteString (p )
64+ h .lp .DrawSizedText (icon , loop.SizedText {Scale : 2 })
65+ h .lp .QueueWriteString (s )
66+ text := r .text
67+ available_width := (h .screen_size .width - 6 ) / 2
68+ if wcswidth .Stringwidth (text ) > available_width {
69+ text = wcswidth .TruncateToVisualLength (text , available_width - 2 ) + "…"
70+ }
71+ h .render_match_with_positions (text , len (r .text ), r .positions , 2 )
5872}
5973
6074func (h * Handler ) render_match_with_positions (text string , stop_at int , positions []int , scale int ) {
61- prefix , suffix , _ := strings .Cut (h .lp .SprintStyled ("fg=green" , " " ), " " )
75+ prefix , suffix , _ := strings .Cut (h .lp .SprintStyled (matching_position_style , " " ), " " )
6276 write_chunk := func (text string , emphasize bool ) {
6377 if text == "" {
6478 return
0 commit comments