mirror of
https://github.com/msberends/AMR.git
synced 2026-11-16 05:50:48 +01:00
(v3.1.0.9009) Fix the misaligned arrows in the message on taxonomically renamed microorganisms in colour-supporting consoles, by padding on the visible width instead of using format() (fixes #336)
This commit is contained in:
1 parent
08e68037db
commit
92bb8931c5
3 files changed
+11
-4
No files matched your search
@@ -1144,7 +1144,10 @@ print.mo_renamed <- function(x, extra_txt = "", n = 25, ...) {
|
||||
rows <- seq_len(min(NROW(x), n))
|
||||
|
||||
message_("The following microorganism", ifelse(NROW(x) > 1, "s were", " was"), " taxonomically renamed", extra_txt, ":")
|
||||
old_format <- format(paste0(font_italic(x$old[rows], collapse = NULL), x$ref_old[rows])) # format() will set trailing spaces for textual alignment
|
||||
old_format <- paste0(font_italic(x$old[rows], collapse = NULL), x$ref_old[rows])
|
||||
# pad based on the visible width, since format() counts ANSI codes as characters
|
||||
visible_width <- nchar(font_stripstyle(old_format), type = "width")
|
||||
old_format <- paste0(old_format, strrep(" ", max(visible_width) - visible_width))
|
||||
old_format <- gsub(" ", "\u00a0", old_format, fixed = TRUE)
|
||||
for (old_tax in rows) {
|
||||
message_("\u00a0\u00a0", AMR_env$bullet_icon, " ", old_format[old_tax], " -> ", font_italic(x$new[old_tax]), x$ref_new[old_tax], as_note = FALSE)
|
||||
|
||||
Reference in new issue
Block a user