Commit Graph

50 Commits

Author SHA1 Message Date
2758b864bc fix bug found by unit test: when deleting leftwards, we should never delete beyond the end of the line 2025-09-20 18:04:59 +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
4c1a76ae67 begin reimplementing motion to move cursor up (vi's 'k' command), although it is in progress and buggy 2025-09-19 04:59:40 +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
f1a06f946d add searchScrollColumn to NORMAL_SEARCH_MODE variant, and update and recalculate it where needed 2025-09-14 09:50:07 +01:00
0a0f723b9b add '<count>yx' function to both yank and delete a specified character 2025-09-07 23:39:33 +01:00
b7e0bab04a modify dedent functionality to support dedenting multiple lines, acting on count parameter 2025-09-07 15:12:34 +01:00
345801ea08 implement indenting for multiple lines, using the 'count' parameter 2025-09-07 14:34:00 +01:00
f7960efab1 add dedent functionality 2025-09-07 14:03:31 +01:00
299735f500 only update search list if timestamp for search message is greater than the buffer's modified time 2025-09-07 13:37:14 +01:00
f3c1905c0c when constructing SEARCH message, include time in the message as well. This will enable us to ignore any messages when we have a 'later' state available. 2025-09-07 13:24:41 +01:00
89c4e85c98 add indent-line functionality 2025-09-07 13:13:00 +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
6ab3e592ad add yank-delete motions like 'ydw' and so on 2025-09-06 03:53:47 +01:00
0dede58ca0 done parsing yank-around 2025-09-06 02:59:05 +01:00
0506cf6176 done implementing 'yankInside' functions and functionality. 2025-09-06 02:27:01 +01:00
9369bbed93 in normal mode, when we receive an event which we don't want to handle (like enter), we clear the app's mode and command history instead of simply returning the same app unmodified. This fixes a bug: say we pres 'f' to go to a character and then press enter. Before this commit, pressing a character after that 'enter' will go to that character. This is contrary to Vim, which resets the command history on an invalid command, and now we reset the command history too. 2025-09-06 01:40:32 +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
b9332bcd94 fix bugs related to deleting ('dge' and 'dgE' motions should also delete the letter which the cursor is currently at, and now they do) 2025-09-06 00:02:37 +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
367e691349 implement additional non-terminal yank commands 2025-09-04 00:50:16 +01:00
e1a15ab1d0 append non-terminal characters after string in yank 2025-09-02 22:41:34 +01:00
6cd038cf81 done refactoring terminal yank commands 2025-09-02 12:46:30 +01:00
d7f69574af a bit of refactoring 2025-09-02 12:39:50 +01:00
d135526386 refactoring, and fix bug in 'y^' motion. (When cursor is after first-non-space-character, copy from first-non-space-character to cursor. Otherwise, copy spaces at beginning until first-non-space-character.) 2025-09-02 12:33:02 +01:00
44441ad26b add two additional terminal yank operations: '<count-y-n> for copying to next match, and <count-y-N> for copying to prev match 2025-09-02 11:48:14 +01:00
a90cdf7943 implement a couple of more yank operations 2025-09-02 11:35:29 +01:00
1d631a708c implement a few more yank motions 2025-09-02 09:43:50 +01:00
74f1fb77ab parse a few additional motions for yanking 2025-09-02 03:13:01 +01:00
ea38e95e6b add a few additional motions to be parsed by yank 2025-09-02 03:07:50 +01:00
298cec88b3 create higher order functions to remove boilerplate code when implementing different yank cases 2025-09-02 02:55:19 +01:00
b3436b2963 implement function to yank a single line 2025-09-02 02:37:08 +01:00
faac32e0f8 add note about unhandled keys in normal mode 2025-09-01 12:01:54 +01:00
3e69c41d8f implement functionality for left and right arrow keys to move cursor left/right when entering searchString in NORMAL_SEARCH_MODE 2025-09-01 11:33:01 +01:00
b80bc3d93c add searchCursorIdx field specific to NORMAL_SEARCH_MODE which we will later use to keep track of where to add/remove characters in the in-progress searchString from 2025-09-01 03:18:45 +01:00
71c77fc6ac redraw screen when we change from NORMAL_MODE to NORMAL_SEARCH_MODE, so it is visually clear that we have changed modes 2025-09-01 03:04:39 +01:00
f4a4dd9161 scaffolding for backspace functionality 2025-09-01 02:52:05 +01:00
a86befdea8 a bit of refactoring 2025-08-31 06:28:05 +01:00
542da2229c a little additional scaffolding for normal mode 2025-08-31 02:41:37 +01:00
0dd7a69777 propagate 'time' value throughout normal mode updating 2025-08-20 13:12:07 +01:00
28593486ed refactor command-parsing code for normal mode, so that non-character events (KEY_ESC, RESIZE_EVENT, WITH_SEARCH_LIST) are dealt with at the beginning, and that the remainder of the parsing code looks at the current string and the new character typed. This is safe because pattern matching on the other commands (KEY_ESC, RESIZE_EVENT, WITH_SEARCH_LIST) always calls the same functions. 2025-08-08 23:23:40 +01:00
3b8faf28e4 add d% motion for deleting a matching pair 2025-08-08 07:30:39 +01:00
f848d4f301 done implementing 'deleteInside' and 'deleteAroundd' commands 2025-08-07 23:33:40 +01:00
1bdf8e457b implement 'deleteInside' motions 2025-08-07 19:12:01 +01:00
b6960f4c68 implemented 'diw' and 'diW' commands for deleting inside a word or WORD 2025-08-07 18:33:03 +01:00
c6f40ba9a0 remove unnecessary linebreak 2025-08-07 18:12:27 +01:00
14f97ecc57 done refactoring normal mode functions 2025-08-07 18:09:52 +01:00