\xx indentation proportional to function depth
Expected behavior: With R_indent_commented=1, pressing \xx comments a line with '# ', then reindents it to align with indented code.
Actual behavior: With R_indent_commented=1, extra spacing is inserted between the '#' and the comment text. The amount of spacing is proportional to the nesting of the function
Upon further investigation, the following happens: Within a function, add a new line. Remove indentation so that text on the news line starts at the beginning of the line. Then \xx indents the line and prepends '# ' (i.e., with a single space as expected). Press \xx twice, however, and the extra spacing is added. What seems to be happening is that the text and its indentation is being inserted after '# ', then the line is indented a second time. If you count it, the spacing after the '#' is always one space greater than the spacing beforehand.
Could you, please:
- Paste a sample code that I could use (I can't copy the text from the image).
- Show two images: one with the actual indentation and the other with the indentation that would be the correct indentation.
Sample code (formatted as expected):
fun1 <- function() {
# comment1
print('p1')
fun2 <- function() {
# comment2
print('p2')
fun3 <- function() {
# comment3
print('p3')
}
}
}
Result of pressing \xx twice on each comment line:
fun1 <- function() {
# comment1
print('p1')
fun2 <- function() {
# comment2
print('p2')
fun3 <- function() {
# comment3
print('p3')
}
}
}
I can't replicate the issue. Even if I do <LocalLeader>xx many times, the commented lines remain as in the first sample code.