diff --git a/helix-term/src/commands/engine/steel.rs b/helix-term/src/commands/engine/steel.rs index c0469e40f..5f9f085be 100644 --- a/helix-term/src/commands/engine/steel.rs +++ b/helix-term/src/commands/engine/steel.rs @@ -1035,6 +1035,7 @@ fn load_editor_api(engine: &mut Engine, generate_sources: bool) { // Arity 1 module.register_fn("editor->text", document_id_to_text); module.register_fn("editor-document->path", document_path); + module.register_fn("register->value", cx_register_value); module.register_fn("set-editor-clip-right!", |cx: &mut Context, right: u16| { cx.editor.editor_clipping.right = Some(right); @@ -1112,6 +1113,7 @@ fn load_editor_api(engine: &mut Engine, generate_sources: bool) { template_function_arity_1("editor-doc-exists?"); template_function_arity_1("editor->text"); template_function_arity_1("editor-document->path"); + template_function_arity_1("register->value"); template_function_arity_1("set-editor-clip-top!"); template_function_arity_1("set-editor-clip-right!"); @@ -3069,6 +3071,15 @@ fn cx_is_document_in_view(cx: &mut Context, doc_id: DocumentId) -> Option Vec { + let items = cx + .editor + .registers + .read(name, cx.editor) + .map_or(Vec::new(), |reg| reg.collect()); + items.into_iter().map(|value| value.to_string()).collect() +} + fn cx_document_exists(cx: &mut Context, doc_id: DocumentId) -> bool { cx.editor.documents.get(&doc_id).is_some() }