fully remove 'word_type' datatype from cursor.sml

This commit is contained in:
2024-10-24 13:44:12 +01:00
parent 5534fd3645
commit 8b3bd97af3
2 changed files with 49 additions and 78 deletions

View File

@@ -839,25 +839,6 @@ struct
cursorIdx
end
(*
* nvim's motion.txt document describes a word as:
* - A sequence of (letters, digits and underscores)
* - or a sequence of other non-blank characters
* - separated by white space (space, tab, <EOL>)
*)
datatype word_type =
ALPHA_NUM
| SPACE
| NON_BLANK
fun getWordType chr =
if Char.isAlphaNum chr orelse chr = #"_" then
ALPHA_NUM
else if Char.isSpace chr then
SPACE
else
NON_BLANK
fun isNextChrSpace (strPos, str, strTl) =
if strPos + 1 < String.size str then
let
@@ -1150,8 +1131,7 @@ struct
| (_, _) => cursorIdx
end
fun helpEndOfWordString
(strPos, str, absIdx, stl, ltl) =
fun helpEndOfWordString (strPos, str, absIdx, stl, ltl) =
if strPos = String.size str then
helpEndOfWordList (stl, ltl, absIdx)
else
@@ -1188,22 +1168,13 @@ struct
fun startEndOfWord (shd, strIdx, absIdx, stl, ltl) =
(* we want to start iterating from next char after strIdx *)
if strIdx - 1 < String.size shd then
let
val nextChr = String.sub (shd, strIdx + 1)
in
helpEndOfWordString
(strIdx + 1, shd, absIdx + 1, stl, ltl)
end
else
case (stl, ltl) of
(stlhd::stltl, ltlhd::ltltl) =>
let
val nextChr = String.sub (stlhd, 0)
val wordType = getWordType nextChr
in
helpEndOfWordString
(0, stlhd, absIdx + 1, stltl, ltltl)
end
| (_, _) =>
(* tl is empty; just return absIdx *)
absIdx

BIN
shf

Binary file not shown.