Commit Graph

89 Commits

Author SHA1 Message Date
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
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