fix 'MakeNormalDelete.deleteLineBack' test, which failed because we were using the wrong way to check if cursor is currently at the start of the line. We checked '(endOfLine = cursorIdx) which works in most cases to verify that the current position is a newline, but fails when the cursor is at the last non-newline character of the line. This is fixed by being more precise and calling 'Cursor.isCursorAtStartOfLine' to check directly if the cursor is currently at the end of the line.
This commit is contained in:
@@ -547,8 +547,9 @@ struct
|
||||
* then we only want to delete 1 character at this line,
|
||||
* which is the newline the cursor is at.
|
||||
* Otherwise, we want to delete 2 chars by default. *)
|
||||
val buffer = LineGap.goToIdx (endOfLine, buffer)
|
||||
val endOfLine =
|
||||
if endOfLine = cursorIdx then endOfLine + 1 else endOfLine + 2
|
||||
if Cursor.isCursorAtStartOfLine (buffer, endOfLine) then endOfLine + 1 else endOfLine + 2
|
||||
in
|
||||
finishDeleteLineBack (app, buffer, 0, endOfLine, endOfLine, time)
|
||||
end
|
||||
@@ -560,8 +561,9 @@ struct
|
||||
* then we don't want to delete the newline
|
||||
* as we are already deleting the newline
|
||||
* at the start of this range *)
|
||||
val buffer = LineGap.goToIdx (endOfLine, buffer)
|
||||
val endOfLine =
|
||||
if endOfLine = cursorIdx then endOfLine else endOfLine + 1
|
||||
if Cursor.isCursorAtStartOfLine (buffer, endOfLine) then endOfLine else endOfLine + 1
|
||||
|
||||
val buffer = LineGap.goToLine (newCursorLineNumber, buffer)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user