Commit Graph

112 Commits

Author SHA1 Message Date
37b6f6ab0a implement function which searches for one of two chars (given as arguments) and returns the index, or ~1 if neither char is found 2026-01-02 18:12:59 +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
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
11cb00860b reimplemen 'diw' motion to fix failing test 2025-12-12 11:32:03 +00:00
766945ac88 remove some dead code 2025-10-19 14:32:57 +01:00
7d1272180b remove 'Cursor.tillPrevChr', replacing usages of that function with 'Cursor.toPrevChr' 2025-10-19 14:30:26 +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
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
5d20b81bcc adjust functor to move by dfa so that we cannot go to the last char of the file if (last char is a newline and is preceded by a non-newline), but otherwise we can go to the last char of the file. 2025-09-23 11:47:25 +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
859860b19f reimplement vi's 'j' motion, and remove the original function for this motion which was in cursor.sml 2025-09-19 22:33:37 +01:00
2c88341c37 remove code which became dead after reimplementing vi's 'k' motion 2025-09-19 05:27:10 +01:00
e4e3961d41 in NormalMove.moveToLine function, use new LineGap function, 'LineGap.lineNumberToIdx', to get the index a line is at, and delete the Cursor.getLineStartIdx' function which we no longer need, as that functionality is in brolib-sml itself. 2025-09-19 04:45:29 +01:00
b6244d4962 amend motion to move to a line: if the requested line has a linebreak as the next character after it, stay at the current position, or else add 1 to the linebreak's idx so that we go to the first character of the line 2025-09-19 04:03:54 +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
c4fedc6434 fix 'Cursor.getLineStartIdx' function, which should look at the left nodes if there is no relevant line in this node 2025-09-16 22:09:15 +01:00
12478f8ac2 remove references to 'Cursor.clipIdx' and delete that function once it is no longer used 2025-09-16 16:08:01 +01:00
20a542df29 in BinSearch.equalOrMore and BinSearch.equalOrLess, return ~1 if no item is found, for the sake of less ambiguity in usage. Functions that call these have also been adapted. 2025-09-13 02:18:14 +01:00
58e74afffb add function to yank inside WORD 2025-09-06 01:15:45 +01:00
73ec4e7578 bug fix when yanking or deleting inside a word (we should not clip 'high' value, and we should search for end of word strictly); this handles cases like when we only have one character in the buffer, or an empty buffer 2025-09-06 01:12:59 +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
b6960f4c68 implemented 'diw' and 'diW' commands for deleting inside a word or WORD 2025-08-07 18:33:03 +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
fe9dd0f034 progress functorising 2025-08-04 04:24:24 +01:00
895c286b4b additional functorisation progress 2025-08-04 04:14:17 +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
aca8ba44b9 functorise some additional functions to reduce boilerplate 2025-08-04 03:44:45 +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
9662540889 remove a couple of unneded functions 2025-08-03 14:32:44 +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
af900057b0 delete dead code 2025-07-20 17:55:43 +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
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
15fc36c7a4 delete some code which is now dead 2025-07-20 14:10:35 +01:00
90c0d657bc reimplement vi's 'E' command 2025-07-20 14:00:59 +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