Commit Graph

67 Commits

Author SHA1 Message Date
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
649bcb66e1 a bit of refactoring to allow addition of more tests 2025-03-22 05:18:25 +00:00
57f012d655 reimplement vi0 and helper functions so that they are likely faster (vi0 bring cursor to start of current line; before, this was done by checking each character in the string backwards, but now it is done by looking at the line metadata, which is faster for us by some constant factor) 2024-11-26 21:57:02 +00:00
eb3eb6c41f fix bug in '^' motion: only move cursor if (chr = /home/humza/Downloads/sml/shf/fcore/cursor.sml' '), not if Char.isSpace (which also returns true if chr is newline or tab) is true 2024-11-24 20:32:47 +00:00
0bfe549e04 add just one more 'word' test, extract steps to delete from search list into a reusable function (don't need to memorise the steps), and fix bug in cursor.sml where we were looking at tl without calculating correct strIdx 2024-11-23 05:16:37 +00:00
f279dc0937 make 'de', 'dE', 'dj' and 'dk' commands work similarly to vi (details are in comments) 2024-11-14 08:57:31 +00:00
287dc5548d progress implementing searchList data structure 2024-11-11 13:23:37 +00:00
faff848cb4 in cursor.sml's 'helpTillPrevChr' function, properly handle edge case where graphical chr is followed by multiple line breaks 2024-11-09 06:33:32 +00:00
d4d0236dab amend cursor.sml's 'helpTillNextChr' function to work with new line break scheme, and use it to implement 'delete till' functionality starting with 'dt' (for example, 'dta' deletes till 'a', 'dts'detetes till 's', etc.) 2024-11-09 05:35:32 +00:00
74822d1541 rename cursor.sml's 'clipIdxAfterDelete' function to 'clipIdx', simplify it, and use it in other functions too 2024-11-08 20:43:36 +00:00
f02a20c6ea clip idx after delete if necessary 2024-11-08 18:47:26 +00:00
81c516e907 fix very minor issue in cursor.sml's 'helpViL' function (previously returned cursorIdx when non-line breaks is followed by non-line break, but now return cursorIdx + 1 instead which is the correct behaviour, because we want to move the cursor rightwards one position in that case 2024-11-07 21:07:11 +00:00
fdb6e0292a fully done amending 'getCursorColumn' in cursor.sml it seems, because all the inputs I throw at it give the expected results 2024-11-07 21:00:56 +00:00
63f2945334 restore triple-line checking to 'startViK' in cursor.sml, as it seems safer 2024-11-07 20:51:02 +00:00
a77003e348 seem to have viK and viJ fixed for the moment, except when I delete from the first or second line with 'x' (deleting from other lines does not seem to make a difference) 2024-11-07 12:59:03 +00:00
c07afee77f simplify one part of cursor.sml's 'startViK' function, by calling 'helpVi0' rather than 'helpViK' when we know previous char is \n 2024-11-07 11:46:30 +00:00
9f0982ad91 simplify viK and especially startViK in cursor.sml, by only checking (strIdx - 1) and (strIdx - 2) 2024-11-06 19:47:14 +00:00
2e13030efb handle more edge cases of viK (and it is now complete) 2024-11-06 11:52:40 +00:00
62d62a8429 rewrite viK in accordance with previous commits 2024-11-05 21:42:56 +00:00
7f1e5249f0 rewrite Cursor.viJ and Cursor.helpViJ for new line break scheme 2024-11-05 20:25:08 +00:00
b396a1b36b minor fix in Cursor.viH: if strIdx is not in hd of rightStrings, check tl of rightStrings 2024-11-05 19:50:36 +00:00
0315bd6550 rewrite Cursor.viH for new line-break-skip scheme, as mentioned in previous commit 2024-11-05 19:44:49 +00:00
b0a37c5c56 new task: rewrite basic cursor.sml functions (h, j, k, l) to look for 'is line break preceded by non-line break?' rather than 'is there a double line break?' because the second question which is already implemented has buggy behaviour on triple line breaks, where cursor does not go to the place user expects. Currently, on Cursor.viL has been rewritten to match the first question. 2024-11-05 13:14:52 +00:00
9df6f92a33 progress with equivalent of vi's 'x' command 2024-11-05 12:38:01 +00:00
66d4346c74 improvement in Cursor.getLineStartIdx when going to last line in buffer 2024-11-04 02:46:02 +00:00
b368619df3 add functionality to go to specific line in buffer 2024-11-02 13:59:55 +00:00
f7b755d6a6 fix minor bug in cursor.sml (we checked if strPos is equal to 'String.size str - 1' but then accessed strPos + 1, which makes our bound check useless and may cause an exception. Instead, check 'strPos < String.size str - 1' 2024-11-01 03:35:12 +00:00
25f06b1f9a fix minor bug in Cursor.matchPair fuunction; depending on chr at strIdx, we might want to iterate on the leftStrings or on the rightStrings. Before, we iterated on the rightStrings only, but now we iterate on whichever is appropriate 2024-10-31 11:50:18 +00:00
fe317ca220 add missing implementation of Cursor.matchPair when strIdx is in tl 2024-10-31 11:19:10 +00:00
553d4605e7 add implementation of matching cursor pairs 2024-10-31 11:07:52 +00:00
deab30c46d add equivalent of vi's 'ge' and 'gE' commands 2024-10-28 06:52:58 +00:00
22f7c7f8c3 return nonLastLine from helpTillPrevChr function 2024-10-27 02:45:15 +00:00
44af1441cf add equivalent functionality of vi's 'T' command 2024-10-26 22:11:52 +01:00
8ef0365e20 a little refactoring 2024-10-26 21:56:11 +01:00
22ca7c5ed4 add equivalent of vi's 'F' 2024-10-26 21:21:33 +01:00
01213fb2fb fix bug with tillNextChr which would place cursor on a newline 2024-10-26 16:20:24 +01:00
62a9aaaaab progress with moving cursor to specific char (vi's 't' command and vi's 'f' command) 2024-10-26 10:47:45 +01:00
17a69720fd add function to go to first non-space character in line 2024-10-25 21:44:46 +01:00
7a62ad3afc pass higher order function to word motions, for less code duplication 2024-10-25 21:27:58 +01:00
a198840961 add WORD motions (as opposed to word motions) 2024-10-25 21:01:48 +01:00
c2ea6e5e04 just formatting cursor.sml 2024-10-25 15:47:39 +01:00
b79a8696f5 refactor many functions in cursor.sml so they don't need to be mutually recursive 2024-10-25 15:25:39 +01:00
8b3bd97af3 fully remove 'word_type' datatype from cursor.sml 2024-10-24 13:44:12 +01:00
5534fd3645 refactor another cursor.sml function 2024-10-24 13:30:02 +01:00
50a0a3e31b begin preparation to remove 'word_type' datatype in cursor.sml, which will simplify implementation of word motions 2024-10-24 13:13:49 +01:00
1f9b01c858 implement equivalent of vi's 'e' command 2024-10-24 12:29:43 +01:00