File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ module DOM.Util.TextCursor
66 , isCursor , cursorAtStart , cursorAtEnd
77 , isSelection , selectionAtStart , selectionAtEnd
88 , selectAll , moveCursorToStart , moveCursorToEnd
9+ , appendLeft , appendRight
910 , modifySelected , modifyAll
1011 , insert
1112 ) where
@@ -173,6 +174,14 @@ moveCursorToEnd tc = TextCursor
173174 , after: " "
174175 }
175176
177+ -- | Prepend a string, on the left.
178+ appendLeft :: String -> TextCursor -> TextCursor
179+ appendLeft s tc = over _before (s <> _) tc
180+
181+ -- | Append a string, on the right.
182+ appendRight :: TextCursor -> String -> TextCursor
183+ appendRight tc s = over _after (_ <> s) tc
184+
176185-- | Modify just the selected region with an endomorphism.
177186modifySelected :: (String -> String ) -> TextCursor -> TextCursor
178187modifySelected = over _selected
You can’t perform that action at this time.
0 commit comments