aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source/luxc/base.lux
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--new-luxc/source/luxc/base.lux21
1 files changed, 12 insertions, 9 deletions
diff --git a/new-luxc/source/luxc/base.lux b/new-luxc/source/luxc/base.lux
index e900edf6c..612ce70d2 100644
--- a/new-luxc/source/luxc/base.lux
+++ b/new-luxc/source/luxc/base.lux
@@ -3,6 +3,7 @@
(lux (control monad)
(data [text "T/" Eq<Text>]
text/format
+ [product]
["R" result])
[macro #+ Monad<Lux>]
(type ["TC" check]))
@@ -142,12 +143,14 @@
(def: #export (with-cursor cursor action)
(All [a] (-> Cursor (Lux a) (Lux a)))
- (function [compiler]
- (let [old-cursor (get@ #;cursor compiler)]
- (case (action (set@ #;cursor cursor compiler))
- (#R;Success [compiler' output])
- (#R;Success [(set@ #;cursor old-cursor compiler')
- output])
-
- (#R;Error error)
- (#R;Error error)))))
+ (if (T/= "" (product;left cursor))
+ action
+ (function [compiler]
+ (let [old-cursor (get@ #;cursor compiler)]
+ (case (action (set@ #;cursor cursor compiler))
+ (#R;Success [compiler' output])
+ (#R;Success [(set@ #;cursor old-cursor compiler')
+ output])
+
+ (#R;Error error)
+ (#R;Error error))))))