Commit Graph

229 Commits

Author SHA1 Message Date
33866533a3 address remainning todo-notes, which had to do with updating the searchList when we insert into a buffer. 2026-02-08 03:17:19 +00:00
c28ae4d8cd code function that can insert into both searchList and buffer 2026-02-08 02:32:32 +00:00
1fa2a44a2f progress addressing to-do notes in fcore/normal-mode/make-normal-delete.sml, although some notes are still left. The notes that have been addressed involved cases where we create a new buffer containing just a newline, because all of the text in the buffer has been deleted otherwise. In this case, we call 'SearchList.build' and build the search-list from scratch, which is fast because only one character needs to be checked. 2026-02-08 02:16:48 +00:00
0c40cad77a done replacing direct calls to 'LineGap.delete' with calls to 'SearchList.deleteBufferAndSearchList', so that the search list is also deleted from whenever the buffer is deleted from 2026-02-07 22:27:44 +00:00
2292c30cd3 bookmark checkpoint in refactoring code to call funhction which deletes from both (searchList and buffer), instead of just deleting buffer 2026-02-06 20:43:47 +00:00
11a632556c progress refactoring delete functions in fcore/normal-mode/make-normal-delete.sml so that searchList is incrementally rebuilt when buffer is deleted from 2026-02-06 09:41:39 +00:00
df7669b065 progress in changing functions to use 'PersistentVector.delete' so that search list is incremental and not rebuilt from scratch after each deletion 2026-02-06 08:52:11 +00:00
1f2af6aacd amend implementation of 'yw' so that we do not yank newline following last word in line, if we are trying to yank last word 2026-02-04 10:12:04 +00:00
83c660818e begin adding tests for 'yw' yank motion 2026-02-04 09:26:57 +00:00
2ee963a3d8 done implementing tests for yank. Also simplify 'NormalDelete.deleteLineDown' and 'NormalYank.yankLineDown' functions by removing an if-branch which can never trigger. (The code path can only be executed in the event that 'endLineIdx' is on a newline, and there is an if-expression in that branch checking whether 'endLineIdx' is on a newline, which is redundant.) 2026-01-31 22:20:52 +00:00
c0d4155808 adjust 'NormalYank.yankLineDown' function to pass failing test 2026-01-31 21:53:32 +00:00
000cf4ab62 implement 'yj' motion. (Next: add tests for it.) 2026-01-31 12:05:16 +00:00
faa15866f8 seems like 'NormalYankDelete' functions need to yank one character more than the deletion range, so implement that, and make note to add tests for that module 2026-01-23 21:08:12 +00:00
e1077b7780 add tests for 'yk' motion (next: implement 'yj' motion and test it) 2026-01-14 04:49:41 +00:00
66f1fb0b5e implement 'yk' motion (next: add tests for it) 2026-01-13 23:54:48 +00:00
e37e04a2a2 rename 'NormalDelete.deleteLineBack' function to 'NormalDelete.deleteLineUp' which is clearer ('k' in 'dk' motion means move cursor up one line) 2026-01-13 23:40:29 +00:00
f1dd822d5b add tests for 'yl' motion 2026-01-07 07:52:06 +00:00
407f78ce7a fix bug in 'NormalYank.yankRight' function. Instead of calling 'Int.max (endOfLineIdx, high)', we should call 'Int.min (endOfLineIdx, high)' because we are trying to get the smaller number, and not the largest. 2026-01-07 06:55:42 +00:00
cc4716f3db refactor fcore/normal-yank.sml a bit (replace repeated logic with a function call) 2026-01-07 06:49:52 +00:00
8b0031ca71 add tests for 'yh' motion 2026-01-07 06:33:10 +00:00
adb8757ed8 implemented 'yh' motion (yank left) 2026-01-05 10:39:42 +00:00
210d535b9f reimplement 'da<symbol>' motion to first check if it is inside a symbol-pair, just like 'di<symbol>' was reimplemented in recent commits 2026-01-03 08:36:07 +00:00
ba6798f476 make implementation of 'di<symbol>' more robust (we check if the cursor is inside a symbol-pair before checking if there is a symbol pair after the cursor), and add tests for 'di<symbol>' motion 2026-01-03 08:09:08 +00:00
bce2a5a22d finish reimplementing 'di<symbol>' and 'da<symbol>' motions so that they align more closely with the behaviour of Vim. (Todo: test them next) 2026-01-02 20:07:36 +00:00
886f384490 when deleting inside pair, instead of searching either for either chr1 or chr2 and stopping at first match, search instead for openChr and closeChr, and keep an integer tracking what level of nesting we are at. This gives us the behaviour we want, which is to delete the pair at the correct level of nesting. When we encounter openChr, we increment the nesting counter by 1 and continue searching. When we encounter closeChr, if the nesting counter is 0, we return the current index, but if the nesting counter is higher than 0 when encounter closeChr, we decrement the nesting counter by 1 and continue searching. 2026-01-02 18:50:04 +00:00
54ef305314 reimplement d% motion so that it first searches for the next occurrence of a pair-character before trying to match it. (Next: add tests for d% motion.) 2026-01-01 07:05:06 +00:00
44dbe1ffb0 reimplement '/home/humza/Downloads/sml/shf/todo.md' motion so that it has the same behaviour as Vim. (If the cursor is not at a pair character, then check after the cursor to see if we find a pair-character there. If some location after the cursor has a pair-character, then move the cursor to it and find the pair of the character, if any.) 2026-01-01 06:58:30 +00:00
6efce2dd67 make 'dW' motion use transition function that is specific for deleting, and add a test to ensure that 'dW' does not delete a newline when it is not on a newline character 2025-12-27 09:45:11 +00:00
1df0952f08 implement the difference between the 'w' motion and 'dw' motion using the transition table in vi-word-dfa, rather than convoluted if-branching 2025-12-27 08:42:54 +00:00
742b571b4e amend 'dw' motion in line with previous commit 2025-12-27 07:32:22 +00:00
d1b865bda8 implmenet 'daW' motion (next: test it) 2025-12-13 03:57:21 +00:00
204f549c79 implement 'daw' motion 2025-12-13 03:40:32 +00:00
7130fe7dda add tests for 'diW' motion, and fix a bug in the implementation (contiguous spaces were not deleted properly) 2025-12-12 20:08:53 +00:00
90a103082a after performing delete-inside-word motion, make sure we move cursor back by 1 if cursor is on a newline which is preceded by a non-newline character 2025-12-12 11:37:52 +00:00
11cb00860b reimplemen 'diw' motion to fix failing test 2025-12-12 11:32:03 +00:00
137cbfee19 fix bug when saving search from NORMAL_SEARCH_MODE. Previously, when pressing <Enter> to save the search, the tempSearchList (which searches against a subset of the buffer's text instead of all of it, to ensure we do not spend too much time was spent while the user was entering the regex/search string) was being saved instead of the newly built searchList (which executes the DFA against all of the text) 2025-12-02 17:55:25 +00:00
8fdc710db4 begin parsing right-arrow in normal mode, for normal mode commands 2025-11-25 21:37:09 +00:00
d60e8bf7aa add todo note to implement yh/yj/yk/yl motions (yank according to h/j/k/l motions) 2025-11-23 23:44:24 +00:00
eefe5221ba begin parsing left arrow in normal mode 2025-11-23 23:19:31 +00:00
7d1272180b remove 'Cursor.tillPrevChr', replacing usages of that function with 'Cursor.toPrevChr' 2025-10-19 14:30:26 +01:00
60ec24453f reimplement 'yt<char>' motion to use 'Cursor.toNextChr' 2025-10-18 19:55:53 +01:00
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
e07f21d6f4 remove usages of 'Cursor.toNextChr' and delete it 2025-10-18 15:14:41 +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
239aaacfc5 reimplement 't' movement motion the same way that 'f' movement motion was reimplemented in previous commit 2025-10-18 14:05:25 +01:00
e44eae6d46 reimplement 'f' move motion more efficiently, not leaving the LineGap.t data structure while iterating to next count 2025-10-18 14:01:06 +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