@@ -138,58 +138,6 @@ expect_match_ <- function(
138138 return (fail(c(msg_exp , msg_act ), info = info , trace_env = trace_env ))
139139}
140140
141-
142- # Adapted from print.ellmer_prompt
143- show_text <- function (
144- x ,
145- condition ,
146- ... ,
147- max_items = 20 ,
148- max_lines = max_items * 25
149- ) {
150- n <- length(x )
151- n_extra <- length(x ) - max_items
152- if (n_extra > 0 ) {
153- x <- x [seq_len(max_items )]
154- condition <- condition [seq_len(max_items )]
155- }
156-
157- if (length(x ) == 0 ) {
158- return (character ())
159- }
160-
161- bar <- if (cli :: is_utf8_output()) " \u 2502" else " |"
162-
163- id <- ifelse(
164- condition ,
165- cli :: col_green(cli :: symbol $ tick ),
166- cli :: col_red(cli :: symbol $ cross )
167- )
168-
169- indent <- paste0(id , " " , bar , " " )
170- exdent <- paste0(" " , cli :: col_grey(bar ), " " )
171-
172- x [is.na(x )] <- cli :: col_red(" <NA>" )
173- x <- paste0(indent , x )
174- x <- gsub(" \n " , paste0(" \n " , exdent ), x )
175-
176- lines <- strsplit(x , " \n " )
177- ids <- rep(seq_along(x ), length(lines ))
178- lines <- unlist(lines )
179-
180- if (length(lines ) > max_lines ) {
181- lines <- lines [seq_len(max_lines )]
182- lines <- c(lines , paste0(exdent , " ..." ))
183- n_extra <- n - ids [max_lines - 1 ]
184- }
185-
186- if (n_extra > 0 ) {
187- lines <- c(lines , paste0(" ... and " , n_extra , " more.\n " ))
188- }
189- lines
190- }
191-
192-
193141# Adapted from print.ellmer_prompt
194142show_text <- function (
195143 x ,
0 commit comments