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:
@@ -448,7 +448,7 @@ struct
|
|||||||
* but line has fewer chars than preferredColumn
|
* but line has fewer chars than preferredColumn
|
||||||
* note: if in double \n\n linebreak,
|
* note: if in double \n\n linebreak,
|
||||||
* then return absIdx of second 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
|
if String.sub (str, strPos + 1) = #"\n" then
|
||||||
(* we are in double linebreak *)
|
(* we are in double linebreak *)
|
||||||
absIdx + 1
|
absIdx + 1
|
||||||
|
|||||||
Reference in New Issue
Block a user