File tree 1 file changed +14
-2
lines changed
rasa-ext-vim/src/Rasa/Ext
1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import Rasa.Ext.Cursors
11
11
import Control.Monad
12
12
import Control.Lens
13
13
import Data.Default
14
+ import Data.Maybe (fromMaybe )
14
15
import Data.Typeable
15
16
import qualified Yi.Rope as Y
16
17
@@ -178,8 +179,19 @@ normal _ = return ()
178
179
179
180
-- | Move cursors to end of the line
180
181
endOfLine :: BufAction ()
181
- endOfLine = findNext " \n "
182
+ endOfLine = do
183
+ txt <- getText
184
+ overRanges . map $ overBoth $ coordEndOfLine txt
185
+ where
186
+ coordEndOfLine :: Y. YiString -> Coord -> Coord
187
+ coordEndOfLine txt (Coord row col) = Coord row maxColumn
188
+ where
189
+ maxColumn :: Int
190
+ maxColumn = fromMaybe col (txt ^? asLines . ix row . to Y. length )
182
191
183
192
-- | Move cursors to start of the line
184
193
startOfLine :: BufAction ()
185
- startOfLine = findPrev " \n "
194
+ startOfLine = overRanges . map $ overBoth coordStartOfLine
195
+ where
196
+ coordStartOfLine :: Coord -> Coord
197
+ coordStartOfLine (Coord x _) = Coord x 0
You can’t perform that action at this time.
0 commit comments