Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@

16. `copy()` is now more consistent about reallocating nested `data.table`s, [#7456](https://github.com/Rdatatable/data.table/issues/7456). The resulting list is now only overwritten when necessary, list columns inside data.tables are searched recursively, and their attributes are walked in search of data.tables to reallocate as well. Thanks to @be-marc for the report, @david-cortes for additional information, and @aitap for the fix.

17. `print()` works with multi-byte characters on R before 4.2.0, [#7848](https://github.com/Rdatatable/data.table/pull/7848). Thanks @MichaelChirico for the fix and @aitap for the improvement.

### Notes

1. {data.table} now depends on R 3.5.0 (2018).
Expand Down
5 changes: 3 additions & 2 deletions R/print.data.table.R
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,9 @@ char.trunc = function(x, trunc.char = getOption("datatable.prettyprint.char")) {
if (is.null(trunc.char)) return(x)
trunc.char = max(0L, suppressWarnings(as.integer(trunc.char[1L])), na.rm=TRUE)
if (!is.character(x) || trunc.char <= 0L) return(x)
nchar_width = nchar(x, 'width', allowNA = TRUE)
nchar_chars = nchar(x, 'char', allowNA = TRUE)
# TODO(R>=4.2.0): we only need the tryCatch() for old bug in allowNA=TRUE, see #7848
nchar_width = tryCatch(nchar(x, 'width', allowNA=TRUE), error=function(.) NA)
nchar_chars = nchar(x, 'char', allowNA=TRUE)
is_full_width = nchar_width > nchar_chars
is_full_width[is.na(is_full_width)] = FALSE
idx = !is.na(x) & !is.na(nchar_width) & pmin(nchar_width, nchar_chars) > trunc.char
Expand Down