18 lines
540 B
Fennel
18 lines
540 B
Fennel
(local util (require :lib.util))
|
|
(local core (require :core))
|
|
(local command (require :core.command))
|
|
(local keymap (require :core.keymap))
|
|
(local common (require :core.common))
|
|
|
|
(fn inline-eval [eval]
|
|
(let [ldoc core.active_view.doc
|
|
(aline acol bline bcol) (ldoc:get_selection)
|
|
inject #(ldoc:insert bline bcol (eval $1))]
|
|
(if (and (= aline bline) (= acol bcol))
|
|
(inject (ldoc:get_text aline 1 aline 10000000))
|
|
(inject (ldoc:get_text aline acol bline bcol)))))
|
|
|
|
(require :editor.editmode)
|
|
|
|
{: inline-eval}
|