Commit Graph

40 Commits

Author SHA1 Message Date
8d29bfab78 adjust nfa to return all matches in string, instead of just testing for one match and then returning true 2025-09-29 10:28:03 +01:00
64678bf68e add tests for 'dE' motion 2025-09-27 15:40:26 +01:00
0b490b00bb add tests for 'de' motion 2025-09-27 10:02:05 +01:00
8ad5cc77c3 change colour of text in search bar as well 2025-09-27 08:35:52 +01:00
cd31bdd0d5 add tests for 'dW' motion, which are same as tests for 'dw' motion but testing for WORD instead of word where possible 2025-09-27 07:14:26 +01:00
9e0f62d142 add another test for 'dw' motion when deleting in the second of three words (this one passes) 2025-09-26 07:32:35 +01:00
b31d7650a8 change the way we calculate the newCursorIdx when we delete using the 'dk' motion while on the last line. We go to the buffer's last line and find the first column. This more directly expresses what we want and now passes the failing unit test for 'dk'. 2025-09-25 14:59:29 +01:00
1494d5c356 add two new unit tests for 'dk' motion 2025-09-25 13:58:56 +01:00
bf55373f6d fix 'MakeNormalDelete.deleteLineBack' test, which failed because we were using the wrong way to check if cursor is currently at the start of the line. We checked '(endOfLine = cursorIdx) which works in most cases to verify that the current position is a newline, but fails when the cursor is at the last non-newline character of the line. This is fixed by being more precise and calling 'Cursor.isCursorAtStartOfLine' to check directly if the cursor is currently at the end of the line. 2025-09-25 10:49:20 +01:00
594367d6d8 add another failing unit test for 'dk' motion 2025-09-25 10:02:16 +01:00
11015dfa9e add two more test cases for 'dj' motion that were failing when added, and modify 'MakeNormalDelete.deleteLineDown' to handle them 2025-09-25 05:28:13 +01:00
80078196e0 if 'MakeNormalDelete.deleteLine' deletes to the end of the file such that there is no newline at the end, then append a newline. This makes one of the tests we have pass. 2025-09-24 13:05:13 +01:00
95a4f109bd progress reimplementing 'j' motion to pass new tests 2025-09-23 15:22:49 +01:00
5fded45303 remove redundant test 2025-09-23 11:11:33 +01:00
4f20379219 take care of a few tests after refactoring/making a different design decision 2025-09-23 11:04:47 +01:00
90eeb6e570 restore temp.txt to original version, as it was being edited for testing purposes 2025-09-22 07:46:45 +01:00
5315aff600 reimplement 'j' motion so that newline is skipped only if immediately preceded by char 2025-09-22 05:32:03 +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
578d3af5ec remove changes to temp.txt which were only for testing 2025-09-16 15:55:16 +01:00
19d2235686 refactor 'MakeNormalDelete.removeLineBreaks' function to remove function call to 'Cursor.clipIdx', instead relying on textLength field in buffer 2025-09-16 15:53:41 +01:00
18d2579605 remove todo-exception from 'G' (NormalMove.goToEnd) command. The todo was a reminder to implement a way to get the scroll line when moving to the end. We have that implemented now. 2025-09-13 18:15:30 +01:00
bbe39f90d4 move cursor to low/cursorIdx in helper function 2025-09-13 08:48:00 +01:00
295bdc35cf fix bug where some lines were not scrolling horizontally properly. The issue was that, when encountering a line break in 'skipToFirstVisualColumn' function, we should have recursively called the 'skipToFirstVisualColumn' function instead of the 'build' function. The reason is that our current column after a line break is 0, but we don't know if the start column to display is necessarily 0 in all cases. 2025-09-13 00:14:07 +01:00
42bd641be4 add a function to remove line breaks: the equivalent of Vim's 'J' command. 2025-09-06 04:39:53 +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
5ba82ea7e1 if we can fit at least 80 chars in a single line on the screen, centre all visible text on the screen 2025-08-31 01:15:29 +01:00
83e062eb60 fix visual bug resulting from 'TextBuilder.buildTextStringSearch' function. When we have a search string 'abc' and a file 'abcabc', there are two matches and it should also look like there are two matches, but it did not look like there were two matches prior to this commit. This commit fixes that by advancing the search position before adding to the text accumulator. 2025-08-31 00:05:48 +01:00
2b3f0405c6 reimplement search-range functionality to scan range from the string from left to right 2025-08-30 23:31:55 +01:00
de46376e4e reimplement search list functionality (when building whole search list, not from range) to start from index 0, to get rid of edge cases resulting from reading the string backwards 2025-08-30 23:05:11 +01:00
7497dc7e7a add code for clojure-style persistent vectors 2025-08-30 18:12:47 +01:00
0647589f13 handle edge case in searching: when we look for 'abba' in the text 'abbabba', it looks like we should have two matches, but to be consistent with other programs, we only have one match 2025-08-30 17:16:02 +01: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
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
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
47f4d452fe amend error in cursor.sml's 'getCursorColumn' function, where we may need to check tail of string to start convert cursorIdx to relative strIdx 2024-10-19 23:04:26 +01:00
19073cb56c improve code to move rightwards in cursor.sml (making it clearer with comments), and improve code to draw cursor at newline in text=builder.sml 2024-10-17 08:40:28 +01:00
0299a9e6b2 draw cursor at newline linebreaks (only \n though and not \r\n) 2024-10-17 06:25:43 +01:00
428e5f2ecd complete implementation of rightwards navigation (viL) 2024-10-17 02:57:26 +01:00