Commit Graph

48 Commits

Author SHA1 Message Date
5c5910f748 change vi-caps-word-dfa.sml to regard newlines as final states, as with vi-word-dfa.sml in previous commit 2025-12-27 09:35:32 +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
9846750c51 change implementation of 'word' so that we stop at newlines when we press 'w' motion, like in Vim and add tests to verify this behaviour (todo: fix regressions in deletion tests) 2025-12-27 06:05:36 +00:00
0255b127a7 fix minor bug in make-dfa-loop.sml: when folding backwards using an if-statement, make sure we start folding from the leftStrings if the cursorIdx < 0 2025-09-25 08:34:23 +01:00
79d232df7a amend very minor bug: when looping through DFA and hitting a 'final state', we let the next chr afterwards handle the start state, but we want the current char to handle the start state instead, as this matches vim's behaviour 2025-09-23 07:36:51 +01:00
cdc23945a5 reimplement vi's 'h' movement, so that we only skip newline characters that immediately follow a non-newline 2025-09-21 21:36:59 +01:00
d63201ada7 reimplement vi's 'l' motion so that we only skip a newline when it is preceded by a non-newline character 2025-09-21 17:49:30 +01:00
d871ac451f restore temp.txt to previous state, as it was temporarily being edited for testing 2025-09-19 03:04:10 +01:00
ab2f2cc752 simplify 'vi-hl-dfa's DFA, removing one state 2025-09-19 02:40:14 +01:00
ad7d103f61 rename 'ViLDfa' structure to 'ViHlDfa' since this DFA implements both vi's 'h' motion and vi's 'l' motion 2025-09-17 11:02:11 +01:00
dbf05ec8dc refactor Cursor.viH to use DFA 2025-09-17 10:45:37 +01:00
9ddb5f68d7 fix bugs in vi-l-dfa (we want to stop looping when the counter is ~1, because the starting character will likely be final/a not-newline, and we want to loop at least once; also, we want to special case 'twoNewlineState' as a final case which causes us to go backwards by 1 instead of treating 'oneNewlineState' as a final/special case). We also modify other code to use the new vi-l implementation in the program. 2025-09-17 03:52:31 +01:00
5174a5b0a4 adjustments to vi-l-dfa: we should accept a single-newline as a final state, but not a double-newline 2025-09-17 02:35:32 +01:00
161caee62a create DFA for Vi's 'l' motion 2025-09-17 02:31:38 +01:00
c94aa72015 create 'MakeIfCharFolderNext' functor, which mirrors the 'MakeIfCharFolderPrev' functor that we already have 2025-09-17 02:20:36 +01:00
96521f358f when looping through a DFA in a functor, make sure we return the absolute index to the calling function and not a modified version of the absolute index which has already been clipped 2025-09-16 21:35:48 +01:00
0793744e24 minor bug fix: when we start looping backwards in a DFA and the rightStrings is empty, start iterating from leftStrings if possible 2025-09-16 03:05:33 +01:00
11212430f4 fix bug with ViDlrDfa.next: we previously did not consider the case of cursor starts on a line containing nothing but a blank \n newline. We consider this now, returning the same index when it occurs. 2025-09-07 20:59:13 +01:00
76e14ea491 add functions to yank to end-of-previous-character, and to yank from current line to start of buffer 2025-09-05 23:46:10 +01:00
6d9ad9b13b rename a file and a structure because another file with the same name exists, except that one is lowercase and the other is uppercase. Case insensitive filesystems don't like that they had the same name before, except for the case. 2025-09-02 02:14:12 +01:00
528aea59a1 reimplement vi's '$' motion as a DFA, also eliminating a bug that involves double deleteion in the process 2025-08-04 05:37:08 +01:00
55e5778ff7 pass env argument in if-character-folder functor, to make it more generic (can access some environment data, which enables more reuse) 2025-08-04 04:05:39 +01:00
cef8467ff6 begin functorising some char iterators which use if-expressions instead of DFAs 2025-08-04 03:23:27 +01:00
e55a7e2bca add separate folder when deleting end of current word, so that we can fix 'de' and 'dE' motions (the result of the folders for the cursor motion is meant to be decremented by 1, but the result for deleting is not meant to be decremented or incremented at all) 2025-08-03 17:35:33 +01:00
0f3b6a39fb done functorising character iterators for vi word 2025-08-03 17:13:26 +01:00
bf9e8be3b0 almost done functorising character iterators for vi word 2025-08-03 17:10:15 +01:00
cd6ce4ffcc begin functorins vi word char iterators 2025-08-03 17:01:50 +01:00
cf93d5885f remove unneeded function 2025-08-03 16:52:55 +01:00
cc276b5454 functorise character folders for vi WORD 2025-08-03 16:48:45 +01:00
b8a5df814e begin functorising some char-iteration functions 2025-08-03 16:34:31 +01:00
473ea8e35d functorise character folders to reduce repetitive boilerplate code (but have not functorised yet) 2025-08-03 16:21:36 +01:00
e078ca89d2 refactor some code to use looping in DFA (which is faster than looping outside of the data structure) 2025-08-03 14:17:25 +01:00
a8ee1d5d37 a little refactoring to make implementation of word and WORD selection (viW, ciW, diW) easier 2025-07-21 09:40:32 +01:00
d3e54d4102 reimplement vi's 'e' command 2025-07-20 17:48:45 +01:00
146953c25d reimplement vi's 'b' command 2025-07-20 17:36:33 +01:00
33474fb5ae formatting 2025-07-20 16:57:22 +01:00
41ca612ca1 reimplement vi's 'ge' command (endOfPrevWord) 2025-07-20 16:55:42 +01:00
8d67c33893 reimplement vi's 'w' command to use ViWordDfa 2025-07-20 16:04:48 +01:00
90c0d657bc reimplement vi's 'E' command 2025-07-20 14:00:59 +01:00
2b060b99a0 add a 'MakeNextDfaLoopPlus1' functor to later use in forward word motions which ignore state of current character but start tracking state from next character. To be used in reimplementations of Vi's 'e' and 'E' commands. 2025-07-20 13:52:23 +01:00
c6f4d1d8f3 reduce indentation level in MakeDfaLoop functors a bit, by performing 'strIdx = ...' calculation before we branch in case expression 2025-07-20 13:48:14 +01:00
f57af737b9 further refactoring, functorising a function because it will later be used elsewhere as well 2025-07-20 13:39:48 +01:00
554c3b0354 done refactoring 'startOfCurrentWORD' function, with tests still passing 2025-07-20 13:28:40 +01:00
6b5a95ff45 reimplemented vi's 'B' command (although it needs a little refactoring) 2025-07-20 13:09:21 +01:00
cf15077480 a bit of refactoring 2025-07-20 09:56:32 +01:00
10b76d98c5 functorise some boilerplate code to start a DFA loop 2025-07-20 09:39:17 +01:00
25fb8bfc5e make DFA for vi next WORD motion, still passing tests 2025-07-20 09:12:23 +01:00