Commit Graph

72 Commits

Author SHA1 Message Date
9f53c5549a rename 'Cursor.toNextChrNew' function to 'Cursor.toNextChr', and update usages to change the name as well. 2025-10-18 15:17:26 +01:00
ee96419901 repace usage of 'Cursor.toNextChr' with 'Cursor.toNextChrNew' ins make-normal-delete.sml 2025-10-18 15:07:14 +01:00
d7adae374f reimplement 'dt' motion 2025-10-18 14:59:37 +01:00
bc44c7bcd0 add another test for 'df<char>' motion, checking that we leave a newline behind if the whole buffer is deleted 2025-10-18 14:29:20 +01:00
5d00da2cbb reimplement 'df' motion as per previous commits, and add a new test for 'df' motion to check that cursor does not land on a 'newline following a non-newline' position, after deleting using 'df<char>' 2025-10-18 14:24:16 +01:00
111e0cf66d remove usage of concurrent ml, deciding that we prefer to run everything in the main thread instead 2025-10-17 23:08:16 +01:00
b8beeaaa60 add some more tests for 'df<char' motion, and fix implementation to pass those tests (if our cursor is at the same position after calling 'fMove', then exit the loop to find the next occurrence of <char>) 2025-10-17 16:19:17 +01:00
7676556513 fix failing test for 'd$' motion, which means completing tests for 'd$' motion too 2025-10-16 12:07:27 +01:00
c2eaa5537c modify 'd$' implementation to pass failing test (we don't want to delete newline at end of line, so we don't do that now) 2025-10-16 11:09:20 +01:00
a855cecd25 implement 'dG' motion (need to test it next) 2025-10-16 01:13:14 +01:00
82c1d48c6f add tests for 'dgg' motion 2025-10-15 15:06:04 +01:00
999a35cb8b fix failing test for 'dge' motion: if the deletion takes us to a newliune that follows a non-newline-character, we should decrement the cursor to be on the non-newline-character 2025-10-14 12:31:18 +01:00
be7a9b3035 add minimal modifications to implementation of 'dge' motion, so that failing test for 'dge' motion passes 2025-10-13 22:08:33 +01:00
0de7a9278a progress implementing help-prev-match for vector 2025-10-08 10:27:19 +01:00
3b823d7ae6 delete 'nextMatch' function in search-list.sml, and refactor other code to use alternative function 2025-10-08 08:16:20 +01:00
5c8e74ac11 change type of SEARCH message to take a DFA, instead of a searchString 2025-10-08 05:54:19 +01:00
06106f5de8 remove 'searchString' field from app_type, because the same role is fulfilled by new 'dfa' field 2025-10-08 05:40:29 +01:00
8857f49537 pass DFA to 'SearchList.buildRange' function, so that we don't need to parse search string into DFA each time 2025-10-08 05:20:33 +01:00
45fbd85183 move buffer around when calling 'SearchList.buildRange' 2025-09-30 05:40:57 +01:00
fd321c2f14 fix some type errors 2025-09-29 15:02:40 +01:00
d01a1367ae add test for 'dw' case: when we use 'dw' on last word in buffer, and there is no newline after last word, we delete last word fully 2025-09-27 13:09:18 +01:00
88a1489a54 pass failing test case for 'dw'. When we delete to the end of the file and the position the cursor was previously at no longer exists, move cursor to last valid character in file. 2025-09-26 07:46:42 +01:00
b31d7650a8 change the way we calculate the newCursorIdx when we delete using the 'dk' motion while on the last line. We go to the buffer's last line and find the first column. This more directly expresses what we want and now passes the failing unit test for 'dk'. 2025-09-25 14:59:29 +01:00
05abecc70d pass a failing test for 'dk' motion by decrementing newCursorLineNumber if the end of the deletion range is on a newline, and it is also the last char in the buffer 2025-09-25 14:44:39 +01:00
6b0149162f a bit of formatting 2025-09-25 10:50:02 +01:00
bf55373f6d 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. 2025-09-25 10:49:20 +01:00
c13ef69a9e pass failing test for 'dk' by paying attention to newlines 2025-09-25 10:31:02 +01:00
1921f87191 handle edge case which deleted newline incorrectly when it shouldn't, passing failing test for 'dk' motion 2025-09-25 09:49:37 +01:00
02cc5a0e53 make failing test for 'dk' motion pass by appending a newline to the buffer if the buffer becomes empty 2025-09-25 09:09:18 +01:00
1000e74183 pass failing test for 'dj' motion through a different startLine calculation depending on whether cursor is already on a newline or not 2025-09-25 06:34:08 +01:00
cddd03812b implement first pass of 'MakeNormalDelete.deleteLine'; have to add tests for this next 2025-09-25 06:23:12 +01:00
efaadf1337 a bit of refactoring 2025-09-25 06:18:12 +01:00
b73117d075 add failing test for 'dj' motion, and progress reimplementing 'MakeNormalDelete.deleteLine' 2025-09-25 06:11:36 +01:00
d25a06a9ed progress reimplementing 'MakeNormalDelete.deleteLine 2025-09-25 06:04:11 +01:00
11015dfa9e add two more test cases for 'dj' motion that were failing when added, and modify 'MakeNormalDelete.deleteLineDown' to handle them 2025-09-25 05:28:13 +01:00
e24230834e rename existing 'MakeNormalDelete.deleteLine' function to 'MakeNormalDelete.deleteLineDown', make 'dj' and 'ydj' commands use the renamed function, and add a new 'MakeNormalDelete.deleteLine' function (which has no implementation yet). We do this because we want to distinguish between 'dd' and 'dj' commands, allowing 'dd' to delete to the end of the file despite any count, while stoppinhg 'dj' from deleting the file when on the last line. 2025-09-25 04:56:25 +01:00
1255238d6c pass failing tests for 'dj' motion 2025-09-24 19:32:31 +01:00
2076d25653 begin reimplementing 'MakeNormalDelete.deleteLine' function 2025-09-24 17:58:37 +01:00
80078196e0 if 'MakeNormalDelete.deleteLine' deletes to the end of the file such that there is no newline at the end, then append a newline. This makes one of the tests we have pass. 2025-09-24 13:05:13 +01:00
222a9aa43c fix 'MakeNormalDelete.removeChr' by accounting for case when we are deleting from last line but the last line does not end with its own newline 2025-09-24 09:46:28 +01:00
95393e1e13 amand MakeNormalDelete.removeChr function (which is used by 'x' and 'dh' commands) to pass test, which checks that cursorIdx does not fall on newline-after-chr after deletion 2025-09-24 09:02:33 +01:00
00ab086257 remove code related to appending newlines in 'MakeNormalDelete', as we have decided that we allow files which do not end in newlines as well as files that do 2025-09-24 07:18:11 +01:00
0b0d5268fc handle edge case when deleting by DFA: when we are deleting to the end of the file and if cursor is on first character after newline, then we also want to delete preceding newline too. Or else we will end up with two newlines at the end of the file, which is not what we want. 2025-09-23 07:18:58 +01:00
ec10f3e025 tiny amount of formatting 2025-09-23 07:04:41 +01:00
9174e4923c don't deleteByDfa when buffer's length is 1, because that would mean that we would be deleting last newline in file 2025-09-23 07:04:20 +01:00
02ada5765b improve 'MakeNormalDelete.deleteByDfa' function by refraining from deleting the unix-style line ending, if DFA takes us past the ending 2025-09-23 06:09:03 +01:00
cb0dec93a0 simplify implementation of 'MakeNormalDelete.deleteLine 2025-09-22 13:02:08 +01:00
e3148e6ac1 when deleting using a DFA motion, make sure we have a linebreak at the end so that we still have unix-style line endings as an invariant 2025-09-22 12:41:33 +01:00
351f7e9bf9 fix edge case with 'd$' motion: if deleting to end of file, we need to append two newlines 2025-09-22 12:28:08 +01:00
6f968ee8e5 in 'dk' motion, make sure we move the cursor to the start of the previous line in all cases 2025-09-22 09:46:43 +01:00