(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:
dr. M.S. (Matthijs) Berends committed 2026-10-30 09:59:01 +01:00
1 parent 08e68037db
commit 92bb8931c5
3 files changed
+11 -4

No files matched your search

+2 -2
View File
@@ -1,6 +1,6 @@
Package: AMR
Version: 3.1.0.9006
Date: 2026-10-23
Version: 3.1.0.9009
Date: 2026-10-30
Title: Antimicrobial Resistance Data Analysis
Description: Functions to simplify and standardise antimicrobial resistance (AMR)
data analysis and to work with microbial and antimicrobial properties by
+5 -1
View File
@@ -1,4 +1,8 @@
# AMR 3.1.0.9006
# AMR 3.1.0.9009
### Changed
* Microorganism coercion (`as.mo()`)
* Fixed the misaligned arrows in the message on taxonomically renamed microorganisms in colour-supporting consoles, for old names whose author reference lacks "*et al.*" (#336)
### Other
* The manual index on the website was rewritten to improve findability, with sections ordered by task and a filter field
+4 -1
View File
@@ -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)