fix minor bug in cursor.sml (we checked if strPos is equal to 'String.size str - 1' but then accessed strPos + 1, which makes our bound check useless and may cause an exception. Instead, check 'strPos < String.size str - 1'

This commit is contained in:
2024-11-01 03:35:12 +00:00
parent 25f06b1f9a
commit f7b755d6a6
2 changed files with 1 additions and 1 deletions

View File

@@ -448,7 +448,7 @@ struct
* but line has fewer chars than preferredColumn
* note: if in double \n\n linebreak,
* then return absIdx of second linebreak. *)
if strPos = String.size str - 1 then
if strPos < String.size str - 1 then
if String.sub (str, strPos + 1) = #"\n" then
(* we are in double linebreak *)
absIdx + 1

BIN
shf

Binary file not shown.