@@ -120,7 +120,12 @@ expect_match_ <- function(
120120  ok  <-  if  (all ) all(condition ) else  any(condition )
121121
122122  if  (! ok ) {
123-     values  <-  show_text(act $ val , condition )
123+     labels  <-  ifelse(
124+       condition ,
125+       cli :: col_green(cli :: symbol $ tick ),
126+       cli :: col_red(cli :: symbol $ cross )
127+     )
128+     values  <-  show_text(act $ val , labels )
124129    if  (length(act $ val ) ==  1 ) {
125130      which  <-  " " 
126131    } else  {
@@ -144,15 +149,15 @@ expect_match_ <- function(
144149}
145150
146151#  Adapted from print.ellmer_prompt
147- show_text  <-  function (x , matches  =  NULL , max_items  =  20 , max_lines  =  NULL ) {
148-   matches  <-  matches  %|| % rep( TRUE , length( x ) )
152+ show_text  <-  function (x , labels  =  NULL , max_items  =  20 , max_lines  =  NULL ) {
153+   labels  <-  labels  %|| % seq_along( x )
149154  max_lines  <-  max_lines  %|| % (max_items  *  25 )
150155
151156  n  <-  length(x )
152157  n_extra  <-  length(x ) -  max_items 
153158  if  (n_extra  >  0 ) {
154159    x  <-  x [seq_len(max_items )]
155-     matches  <-  matches [seq_len(max_items )]
160+     labels  <-  labels [seq_len(max_items )]
156161  }
157162
158163  if  (length(x ) ==  0 ) {
@@ -161,13 +166,7 @@ show_text <- function(x, matches = NULL, max_items = 20, max_lines = NULL) {
161166
162167  bar  <-  if  (cli :: is_utf8_output()) " \u 2502"   else  " |" 
163168
164-   id  <-  ifelse(
165-     matches ,
166-     cli :: col_green(cli :: symbol $ tick ),
167-     cli :: col_red(cli :: symbol $ cross )
168-   )
169- 
170-   indent  <-  paste0(id , "  "  , bar , "  "  )
169+   indent  <-  paste0(labels , "  "  , bar , "  "  )
171170  exdent  <-  paste0("   "  , cli :: col_grey(bar ), "  "  )
172171
173172  x [is.na(x )] <-  cli :: col_red(" <NA>"  )
0 commit comments