Skip to content

Commit 87ad189

Browse files
don't double count the comma between column and the previous column
1 parent 10b064b commit 87ad189

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

R/detect-alignment.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,11 @@ token_is_on_aligned_line <- function(pd_flat) {
119119
is_aligned <- length(unique(current_col)) == 1L
120120
if (!is_aligned) {
121121
# check 2: left aligned after ,
122-
current_col <- nchar(gsub("^(,[\\s\\t]*)[^ ]*.*$", "\\1", by_line, perl = TRUE))
122+
current_col <- nchar(gsub("^(,[\\s\\t]*)[^ ]*.*$", "\\1", by_line, perl = TRUE)) - 1
123123

124124
if (column > 1) {
125125
# must add previous columns, as first column might not align
126-
current_col <- current_col + previous_line
126+
current_col <- previous_line + current_col
127127
}
128128
is_aligned <- length(unique(current_col)) == 1L
129129
if (is_aligned) {

0 commit comments

Comments
 (0)