diff options
author | Aleksey Kladov <[email protected]> | 2018-08-23 22:13:16 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-08-23 22:13:16 +0100 |
commit | f47f58ffe5fb494c883ec4fd120cdd63ad31cc68 (patch) | |
tree | 88ea9aebf54da8008a9adc359e0e613d6a160a61 /crates/libeditor/src/typing.rs | |
parent | 8ad586a44e2214a11c4e7d27e0d3c2d73e43f39f (diff) |
better join-lines
Diffstat (limited to 'crates/libeditor/src/typing.rs')
-rw-r--r-- | crates/libeditor/src/typing.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/crates/libeditor/src/typing.rs b/crates/libeditor/src/typing.rs index 918f2325c..04021d164 100644 --- a/crates/libeditor/src/typing.rs +++ b/crates/libeditor/src/typing.rs | |||
@@ -72,9 +72,11 @@ fn remove_newline( | |||
72 | if node.kind() == WHITESPACE && node_text.bytes().filter(|&b| b == b'\n').count() == 1 { | 72 | if node.kind() == WHITESPACE && node_text.bytes().filter(|&b| b == b'\n').count() == 1 { |
73 | match (node.prev_sibling(), node.next_sibling()) { | 73 | match (node.prev_sibling(), node.next_sibling()) { |
74 | (Some(prev), Some(next)) => { | 74 | (Some(prev), Some(next)) => { |
75 | let range = TextRange::from_to(prev.range().start(), node.range().end()); | ||
75 | if prev.kind() == COMMA && (next.kind() == R_PAREN || next.kind() == R_BRACK) { | 76 | if prev.kind() == COMMA && (next.kind() == R_PAREN || next.kind() == R_BRACK) { |
76 | let range = TextRange::from_to(prev.range().start(), node.range().end()); | ||
77 | edit.delete(range); | 77 | edit.delete(range); |
78 | } else if prev.kind() == COMMA && next.kind() == R_CURLY { | ||
79 | edit.replace(range, " ".to_string()); | ||
78 | } else { | 80 | } else { |
79 | edit.replace( | 81 | edit.replace( |
80 | node.range(), | 82 | node.range(), |