Skip to content

Commit

Permalink
Add workaround for displaying ellipsis on windows
Browse files Browse the repository at this point in the history
On windows, ellipses are usually outside the chars which can be displayed in our
way to display plain text /with  `capture.output(print(...))` in the current
locale. The leads to strangely escaped chars and we would have such a escaped
chars each time we display a dataframe.

This problem is probably not going away soon:
IRkernel#28 (comment)

Work around this by simple using three dots.
  • Loading branch information
jankatins committed Apr 13, 2016
1 parent dbf491a commit e3c075e
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions R/repr_matrix_df.r
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,17 @@
#' @include utils.r
NULL

ellip.h <- '\u22EF'
ellip.v <- '\u22EE'
ellip.d <- '\u22F1'
# There is currently a problem on windows which can't display chars in th
# text/plain output, which are not available in the current locale.
# See https://github.com/IRkernel/repr/issues/28#issuecomment-208574856
.char_fallback <- function(char, default) {
real_len <- nchar(char)
r_len <- nchar(capture.output(cat(char)))
if (real_len == r_len) char else default
}
ellip.h <- .char_fallback('\u22EF', '...')
ellip.v <- .char_fallback('\u22EE', '...')
ellip.d <- .char_fallback('\u22F1', '')

ellipses <- c(ellip.h, ellip.v, ellip.d)

Expand Down

0 comments on commit e3c075e

Please sign in to comment.