mirror of https://github.com/helix-editor/helix
check if a document has been modified
parent
01cfd2e6d4
commit
bc01dda33a
|
@ -1594,6 +1594,13 @@ Get the `Rect` associated with the currently focused buffer.
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
module.register_fn(
|
||||||
|
"editor-document-dirty?",
|
||||||
|
|cx: &mut Context, doc: DocumentId| -> Option<bool> {
|
||||||
|
cx.editor.documents.get(&doc).map(|x| x.is_modified())
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
module.register_fn("set-buffer-uri!", set_buffer_uri);
|
module.register_fn("set-buffer-uri!", set_buffer_uri);
|
||||||
|
|
||||||
module.register_fn("editor-doc-exists?", cx_document_exists);
|
module.register_fn("editor-doc-exists?", cx_document_exists);
|
||||||
|
@ -1680,6 +1687,11 @@ Get the `Rect` associated with the currently focused buffer.
|
||||||
"Check when a document was last saved (returns a `SystemTime`)",
|
"Check when a document was last saved (returns a `SystemTime`)",
|
||||||
);
|
);
|
||||||
|
|
||||||
|
template_function_arity_1(
|
||||||
|
"editor-document-dirty?",
|
||||||
|
"Check if a document has unsaved changes",
|
||||||
|
);
|
||||||
|
|
||||||
template_function_arity_1("editor->text", "Get the document as a rope.");
|
template_function_arity_1("editor->text", "Get the document as a rope.");
|
||||||
template_function_arity_1("editor-document->path", "Get the path to a document.");
|
template_function_arity_1("editor-document->path", "Get the path to a document.");
|
||||||
template_function_arity_1(
|
template_function_arity_1(
|
||||||
|
|
Loading…
Reference in New Issue