use 'Cursor.clipIdx' in app-update.sml's 'helpDelete' and 'helpDeleteLine' functions, to ensure we never delete last line (unix text files always end with \n)
This commit is contained in:
@@ -370,6 +370,7 @@ struct
|
|||||||
let
|
let
|
||||||
val low = Int.min (cursorIdx, otherIdx)
|
val low = Int.min (cursorIdx, otherIdx)
|
||||||
val high = Int.max (cursorIdx, otherIdx)
|
val high = Int.max (cursorIdx, otherIdx)
|
||||||
|
val high = Cursor.clipIdx (buffer, high)
|
||||||
val length = high - low
|
val length = high - low
|
||||||
val buffer = LineGap.delete (low, length, buffer)
|
val buffer = LineGap.delete (low, length, buffer)
|
||||||
|
|
||||||
@@ -421,6 +422,7 @@ struct
|
|||||||
fun helpDeleteLine (app: app_type, buffer, cursorIdx, otherIdx, count) =
|
fun helpDeleteLine (app: app_type, buffer, cursorIdx, otherIdx, count) =
|
||||||
if count = 0 then
|
if count = 0 then
|
||||||
let
|
let
|
||||||
|
val otherIdx = Cursor.clipIdx (buffer, otherIdx)
|
||||||
val length = otherIdx - cursorIdx
|
val length = otherIdx - cursorIdx
|
||||||
val buffer = LineGap.delete (cursorIdx, length, buffer)
|
val buffer = LineGap.delete (cursorIdx, length, buffer)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user