Skip to content

Commit 491f3c3

Browse files
Merge pull request #693 from MichaelChirico/is-character
- use is.character over inherits(character) (#693)
2 parents 4fdbfd1 + f738c2a commit 491f3c3

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

NEWS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
- empty lines are now removed between pipes (#645).
3030
- overhaul pgkdown site: Add search (#623), group function in Reference (#625).
3131
- always strip trailing spaces and make cache insensitive to it (#626).
32+
- `style_text()` can now style all input that `is.character()`, not just if it
33+
inherits from classes `character`, `utf8` or `vertical` (#693).
3234
- minor documentation improvements (#643, #618, #614, #677, #651, #667, #672,
3335
#687).
3436
- The internal `create_tree()` only used in testing of styler now works when the

R/io.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ read_utf8 <- function(path) {
7575
warning = function(w) w,
7676
error = function(e) e
7777
)
78-
if (inherits(out, "character")) {
78+
if (is.character(out)) {
7979
list(
8080
text = out,
8181
missing_EOF_line_break = FALSE

R/vertical.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#' @param x A character vector or an object of class "vertical".
66
#' @keywords internal
77
construct_vertical <- function(x) {
8-
stopifnot(inherits(x, what = c("utf8", "character", "vertical")))
8+
stopifnot(is.character(x))
99
structure(x, class = "vertical")
1010
}
1111

0 commit comments

Comments
 (0)