@@ -135,6 +135,11 @@ deleteLeftWord (TextZipper lb b a la) =
135 (l:ls) -> deleteLeftWord $ TextZipper ls l a la
135 (l:ls) -> deleteLeftWord $ TextZipper ls l a la
136 else TextZipper lb (T.dropWhileEnd (not . isSpace) b') a la
136 else TextZipper lb (T.dropWhileEnd (not . isSpace) b') a la
138+-- | Insert up to n spaces to get to the next logical column that is a multiple of n
139+tab :: Int -> TextZipper -> TextZipper
140+tab n z@(TextZipper _ b _ _) =
141+ insert (T.replicate (fromEnum $ n - (T.length b `mod` n)) " ") z
138-- | The plain text contents of the zipper
143-- | The plain text contents of the zipper
139value :: TextZipper -> Text
144value :: TextZipper -> Text
140value (TextZipper lb b a la) = T.intercalate "\n" $ mconcat [ reverse lb
145value (TextZipper lb b a la) = T.intercalate "\n" $ mconcat [ reverse lb