You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
trim() calculates the "minimum indent" of every line after the first, and then removes that number of characters from the beginning of every line after the first. I encountered this while working on the related #162.
min_indent is calculated by a routine that ignores indentation (spaces and tabs) on blank lines - lines containing only indentation. Consequently, the newline that terminates these lines can get trimmed, which causes the following line to include spurious leading whitespace.
In the character vector passed to trim(), the penultimate line contains only indentation (6 spaces followed by a tab).
When trim() is copying parts of the old string to a new one, it skips over the newline that delimits the penultimate and last lines, and the whitespace from the penultimate line is included in the last line.
The text was updated successfully, but these errors were encountered:
* Improve handling of lines containing only indentation
* Update NEWS
* Handle short indentation-only lines; fixes#163
* Add test for empty intermediate line handling
Co-authored-by: Jim Hester <james.f.hester@gmail.com>
trim()
calculates the "minimum indent" of every line after the first, and then removes that number of characters from the beginning of every line after the first. I encountered this while working on the related #162.min_indent
is calculated by a routine that ignores indentation (spaces and tabs) on blank lines - lines containing only indentation. Consequently, the newline that terminates these lines can get trimmed, which causes the following line to include spurious leading whitespace.Failing example:
In the character vector passed to
trim()
, the penultimate line contains only indentation (6 spaces followed by a tab).When
trim()
is copying parts of the old string to a new one, it skips over the newline that delimits the penultimate and last lines, and the whitespace from the penultimate line is included in the last line.The text was updated successfully, but these errors were encountered: