feat: create branch for surround implementation for x

pull/12055/head
Nikita Revenco 3 weeks ago
parent b53dafe326
commit 3882bf9e9d

@ -5631,12 +5631,22 @@ fn surround_add(cx: &mut Context) {
// surround_len is the number of new characters being added. // surround_len is the number of new characters being added.
let (open, close, surround_len) = match event.char() { let (open, close, surround_len) = match event.char() {
Some(ch) => { Some(ch) => {
let (o, c) = match_brackets::get_pair(ch);
let mut open = Tendril::new(); let mut open = Tendril::new();
open.push(o);
let mut close = Tendril::new(); let mut close = Tendril::new();
let length = if ch == 'x' {
let (o, c) = match_brackets::get_pair(ch);
open.push(o);
close.push(c); close.push(c);
(open, close, 2) // Any character other than "x" will cause 2 chars to get added
2
} else {
let (o, c) = match_brackets::get_pair(ch);
open.push(o);
close.push(c);
// Any character other than "x" will cause 2 chars to get added
2
};
(open, close, length)
} }
None if event.code == KeyCode::Enter => ( None if event.code == KeyCode::Enter => (
doc.line_ending.as_str().into(), doc.line_ending.as_str().into(),

Loading…
Cancel
Save