|
|
@ -5,6 +5,7 @@ pub(crate) mod typed;
|
|
|
|
pub use dap::*;
|
|
|
|
pub use dap::*;
|
|
|
|
use futures_util::FutureExt;
|
|
|
|
use futures_util::FutureExt;
|
|
|
|
use helix_event::status;
|
|
|
|
use helix_event::status;
|
|
|
|
|
|
|
|
use helix_parsec::{seq, take_until, Parser};
|
|
|
|
use helix_stdx::{
|
|
|
|
use helix_stdx::{
|
|
|
|
path::expand_tilde,
|
|
|
|
path::expand_tilde,
|
|
|
|
rope::{self, RopeSliceExt},
|
|
|
|
rope::{self, RopeSliceExt},
|
|
|
@ -44,9 +45,10 @@ use helix_view::{
|
|
|
|
info::Info,
|
|
|
|
info::Info,
|
|
|
|
input::KeyEvent,
|
|
|
|
input::KeyEvent,
|
|
|
|
keyboard::KeyCode,
|
|
|
|
keyboard::KeyCode,
|
|
|
|
|
|
|
|
register::RegisterValues,
|
|
|
|
theme::Style,
|
|
|
|
theme::Style,
|
|
|
|
tree,
|
|
|
|
tree,
|
|
|
|
view::View,
|
|
|
|
view::{self, View},
|
|
|
|
Document, DocumentId, Editor, ViewId,
|
|
|
|
Document, DocumentId, Editor, ViewId,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
@ -6124,30 +6126,63 @@ fn extend_to_word(cx: &mut Context) {
|
|
|
|
jump_to_word(cx, Movement::Extend)
|
|
|
|
jump_to_word(cx, Movement::Extend)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fn read_from_register(editor: &mut Editor, reg: char) -> Option<RegisterValues> {
|
|
|
|
|
|
|
|
editor.registers.read(reg, editor)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pub fn goto_mark(cx: &mut Context) {
|
|
|
|
pub fn goto_mark(cx: &mut Context) {
|
|
|
|
let register_name = cx.register.unwrap_or('^').clone();
|
|
|
|
let register_name = cx.register.unwrap_or('^').clone();
|
|
|
|
let register_content = cx.editor.registers.read(register_name, cx.editor);
|
|
|
|
let registers_vals = read_from_register(&mut cx.editor, register_name);
|
|
|
|
let res = match register_content {
|
|
|
|
let blurb = registers_vals
|
|
|
|
Some(values) => values
|
|
|
|
.unwrap()
|
|
|
|
.into_iter()
|
|
|
|
.into_iter()
|
|
|
|
.next()
|
|
|
|
.next()
|
|
|
|
.map(|c| c.into_owned())
|
|
|
|
.map(|c| c.into_owned());
|
|
|
|
.map(|s| {
|
|
|
|
// let register_content = editor.registers.read(register_name, editor);
|
|
|
|
let mut split_iter = s.split(":").into_iter();
|
|
|
|
// let reg_str = match values {
|
|
|
|
let doc_id = split_iter.next().unwrap();
|
|
|
|
// Some(values) =>
|
|
|
|
let range_tupel = split_iter.next().unwrap();
|
|
|
|
// .ok_or(format!(
|
|
|
|
log::debug!("doc id: {:?}", &doc_id);
|
|
|
|
// "Register {} did not contain anything",
|
|
|
|
log::debug!("range_tuple: {:?}", &range_tupel);
|
|
|
|
// register_name
|
|
|
|
})
|
|
|
|
// )),
|
|
|
|
.ok_or(format!(
|
|
|
|
// None => Err(format!(
|
|
|
|
"Register {} did not contain anything",
|
|
|
|
// "Register {} did not contain anything",
|
|
|
|
register_name
|
|
|
|
// register_name
|
|
|
|
)),
|
|
|
|
// )),
|
|
|
|
None => Err(format!(
|
|
|
|
// };
|
|
|
|
"Register {} did not contain anything",
|
|
|
|
match blurb {
|
|
|
|
register_name
|
|
|
|
Some(s) => {
|
|
|
|
)),
|
|
|
|
let parser = seq!(
|
|
|
|
|
|
|
|
take_until(|c| c == ':'),
|
|
|
|
|
|
|
|
":(",
|
|
|
|
|
|
|
|
take_until(|c| c == ','),
|
|
|
|
|
|
|
|
",",
|
|
|
|
|
|
|
|
take_until(|c| c == ')'),
|
|
|
|
|
|
|
|
")"
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
let (_tail, (doc_id_str, _, anchor_str, _, head_str, _)) = parser.parse(&s).unwrap();
|
|
|
|
|
|
|
|
let anchor = anchor_str.parse().unwrap();
|
|
|
|
|
|
|
|
let head = head_str.parse().unwrap();
|
|
|
|
|
|
|
|
let doc_id: DocumentId = doc_id_str.try_into().unwrap();
|
|
|
|
|
|
|
|
let range = Range {
|
|
|
|
|
|
|
|
anchor,
|
|
|
|
|
|
|
|
head,
|
|
|
|
|
|
|
|
old_visual_position: None,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
cx.editor.switch(doc_id, Action::Replace);
|
|
|
|
|
|
|
|
let (view, doc) = current!(cx.editor);
|
|
|
|
|
|
|
|
let (min_idx, max_idx) = if anchor < head {
|
|
|
|
|
|
|
|
(anchor, head)
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
(head, anchor)
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
let new_range = range.put_cursor(doc.text().slice(..), min_idx, false);
|
|
|
|
|
|
|
|
let new_range = new_range.put_cursor(doc.text().slice(..), max_idx, true);
|
|
|
|
|
|
|
|
doc.set_selection(view.id, new_range.into());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
None => (),
|
|
|
|
|
|
|
|
// Err(e) => log::error!("{}", e),
|
|
|
|
|
|
|
|
}
|
|
|
|
// let picker = Picker::new(items, (), |cx, meta, action| {
|
|
|
|
// let picker = Picker::new(items, (), |cx, meta, action| {
|
|
|
|
// cx.editor.switch(meta.id, action);
|
|
|
|
// cx.editor.switch(meta.id, action);
|
|
|
|
// })
|
|
|
|
// })
|
|
|
|