pass failing test for 'dj' motion through a different startLine calculation depending on whether cursor is already on a newline or not
This commit is contained in:
@@ -391,7 +391,11 @@ struct
|
|||||||
val startIdx = Cursor.vi0 (buffer, cursorIdx)
|
val startIdx = Cursor.vi0 (buffer, cursorIdx)
|
||||||
val buffer = LineGap.goToIdx (startIdx, buffer)
|
val buffer = LineGap.goToIdx (startIdx, buffer)
|
||||||
|
|
||||||
val startLine = LineGap.idxToLineNumber (cursorIdx + 1, buffer)
|
val startLine =
|
||||||
|
if Cursor.isCursorAtStartOfLine (buffer, startIdx) then
|
||||||
|
LineGap.idxToLineNumber (startIdx, buffer)
|
||||||
|
else
|
||||||
|
LineGap.idxToLineNumber (startIdx + 1, buffer)
|
||||||
val endLine = startLine + count
|
val endLine = startLine + count
|
||||||
|
|
||||||
val buffer = LineGap.goToLine (endLine, buffer)
|
val buffer = LineGap.goToLine (endLine, buffer)
|
||||||
@@ -417,7 +421,11 @@ struct
|
|||||||
val startIdx = Cursor.vi0 (buffer, cursorIdx)
|
val startIdx = Cursor.vi0 (buffer, cursorIdx)
|
||||||
val buffer = LineGap.goToIdx (startIdx, buffer)
|
val buffer = LineGap.goToIdx (startIdx, buffer)
|
||||||
|
|
||||||
val startLine = LineGap.idxToLineNumber (cursorIdx + 1, buffer)
|
val startLine =
|
||||||
|
if Cursor.isCursorAtStartOfLine (buffer, startIdx) then
|
||||||
|
LineGap.idxToLineNumber (startIdx, buffer)
|
||||||
|
else
|
||||||
|
LineGap.idxToLineNumber (startIdx + 1, buffer)
|
||||||
val endLine = startLine + count + 1
|
val endLine = startLine + count + 1
|
||||||
|
|
||||||
val buffer = LineGap.goToLine (endLine, buffer)
|
val buffer = LineGap.goToLine (endLine, buffer)
|
||||||
|
|||||||
@@ -439,7 +439,7 @@ struct
|
|||||||
, test "deletes two lines when cursor is on a newline" (fn _ =>
|
, test "deletes two lines when cursor is on a newline" (fn _ =>
|
||||||
let
|
let
|
||||||
(* arrange *)
|
(* arrange *)
|
||||||
val originalString = "\nhello\nworld\ntrello\brillo\n"
|
val originalString = "\nhello\nworld\ntrello\nbrillo\n"
|
||||||
val originalIdx = 0
|
val originalIdx = 0
|
||||||
|
|
||||||
val app = TestUtils.init originalString
|
val app = TestUtils.init originalString
|
||||||
|
|||||||
Reference in New Issue
Block a user