Commit Graph

61 Commits

Author SHA1 Message Date
5804620846 small optimisation in app-update.sml's 'helpDelete' function, reducing number of allocations by accumulating otherIdx, and deleting from buffer only once loop is over 2024-11-09 09:39:03 +00:00
19aaae72f3 add functionality to delete to chr (equivalent of Vi commands starting with 'df' like 'dfe' to delete to the next 'e', and also add equivalent of 'dFe' to delete backwards) 2024-11-09 09:24:14 +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
e4f46295d4 improvement to app-update.sml's 'deleteEndOfLine' function, where we rely on 'helpRemoveChr' function to handle conditional 'go backwards' logic, and we also make sure not to do anything in 'deleteEndOfLine' if we are at a \n 2024-11-09 03:51:39 +00:00
e1b5352cfb add todo notes for 'parseDelete' function 2024-11-08 22:31:19 +00:00
267efae4cc add another custom delete function ('deleteToFirstNonSpaceChr', which can be triggered with command d^ and it works fine on testing 2024-11-08 22:19:57 +00:00
ae80ef5f21 code function to delete to end of line with command 'd$' (custom function needed because it did not work as expected to pass 'Cursor.viDlr' as a higher order function as with other motions) 2024-11-08 21:52:04 +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
c080b913ae reorganisation app-update.sml to place related functions close together 2024-11-08 18:36:02 +00:00
4574a23dc8 extract reusable function 'buildTextAndClear' (but need to be careful since some functions have specialised build functionality and shouldn't use this function) 2024-11-08 18:27:55 +00:00
f7c99530ae rename function for vi's 'x' command from deleteChr to removeChr, because it helps avoid confusion with motion-based delete (for example, 'dw') 2024-11-08 15:27:16 +00:00
88f4ff6057 progress with delete 2024-11-08 15:19:16 +00:00
a4dea7626f add KEY_ESC message type, and refactor app-update.sml to use it (always calls 'clearMode' function which always sets the app to normal mode, and sets the command strnig to empty) 2024-11-08 09:30:57 +00:00
ff38e39deb do not use 'clearMode' in helpDeleteChr function, because we have 'buffer' and 'cursorIdx' parameters we would like to add to the app state before exiting the loop. Instead, go to end of loop by passing 'count' of 0 2024-11-08 04:25:33 +00:00
36763fce94 add count to 'x' command, allowing [count] chars to be deleted 2024-11-08 04:21:05 +00:00
6b9cf8dbc2 amend problem with TextWindow.getStartLineBefore, where we were not following rule mentioned in previous commits to not count (graphical-chr -> \n) as line break 2024-11-06 12:46:53 +00:00
50d10c1a89 delete-chr (equivalent of vi's 'x' cmd) works fine now, except when deleting from the very first line, where first line may become invisible temporarily. I am not sure why that is happening but will find out. 2024-11-06 12:17:26 +00:00
9df6f92a33 progress with equivalent of vi's 'x' command 2024-11-05 12:38:01 +00:00
a0a8fcc17b change line indexing in AppUpdate.moveToLine from 0-based to 1-based (so first line can be access with 1G, second with 2G, as is normal with Vim) 2024-11-04 02:56:57 +00:00
b368619df3 add functionality to go to specific line in buffer 2024-11-02 13:59:55 +00:00
2a8e02ff3a when pressing fcore/text-window.sml to match pair, only recentre text window if matching pair is not currently visible on screen 2024-11-02 12:34:23 +00:00
553d4605e7 add implementation of matching cursor pairs 2024-10-31 11:07:52 +00:00
601a341992 add functionality to move to end of line 2024-10-30 10:54:55 +00:00
308d042deb add functionality to centre text window to cursor 2024-10-30 10:05:16 +00:00
f2f305c35d add command to go to start of lineGap 2024-10-30 07:51:24 +00:00
c7570707ab 100fcore/app-update.sml done with functionality of getting screen to move (if needed) when cursor moves, including getting screen to move when moving to a new chr (in this commit) 2024-10-28 23:06:32 +00:00
5e1e39ca69 fixed two issues. First is that an exception occurred when sometimes moving cursor forwards. Cause of this issue was that callee functions depended on LineGap being moved to start of line, but this did not always happen (and now it does always happen). Second issue was that moving cursor down did not scroll as expected when line wrapped. The reason for this second issue was that the 'getStartLineAfter' function did not increment 'startLine' value in loop when line wrap occurred. Both issues are now fixed. 2024-10-28 22:54:28 +00:00
bff4c006ed have functionality for cursor to scroll down a line when cursor moves down one line working, but it only seems to work perfectly when there are no visual line breaks 2024-10-28 21:56:07 +00:00
0ed5a23ade some progress moving textWindow, but it is not perfect yet 2024-10-28 10:59:18 +00:00
4b1ee33954 begin moving text window when cursor goes off screen (currently, we only move the window when cursor goes backwards but this works fine and as expected) 2024-10-28 09:34:55 +00:00
deab30c46d add equivalent of vi's 'ge' and 'gE' commands 2024-10-28 06:52:58 +00:00
44af1441cf add equivalent functionality of vi's 'T' command 2024-10-26 22:11:52 +01:00
22ca7c5ed4 add equivalent of vi's 'F' 2024-10-26 21:21:33 +01:00
eeacde8e7a address edge case when '0' is input, because '0' may either be a count if some number preceded it, or else it is a command to go the start of the line 2024-10-26 11:04:04 +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
f9990636df list non-terminal commands 2024-10-26 06:54:15 +01:00
816f064558 progress parsing normal mode commands 2024-10-26 06:01:48 +01:00
17a69720fd add function to go to first non-space character in line 2024-10-25 21:44:46 +01:00
39e867bd35 reduce code duplication in app-update.sml by using higher order function 2024-10-25 21:10:53 +01:00
a198840961 add WORD motions (as opposed to word motions) 2024-10-25 21:01:48 +01:00
1f9b01c858 implement equivalent of vi's 'e' command 2024-10-24 12:29:43 +01:00
15ff3a111a implement equivalent of vi's 'b' cursor motion 2024-10-24 06:26:40 +01:00
80cdcdccd6 implement nextWord in cursor.sml (vi's lowercase w) 2024-10-23 04:31:34 +01:00
b22222cf5d implement vi0 and viDlr (viDlr = function called when pressing $), which both work fine 2024-10-21 03:04:47 +01:00
e08f2c4f77 add implementation of viK, completing hjkl movement keys 2024-10-21 01:34:54 +01:00
6b3d322c1c progress with viJ to move cursor downwards 2024-10-20 21:30:06 +01:00
7fd59c734a add function to retrieve column that cursor is on, relative to line 2024-10-19 07:03:32 +01:00
5f4be185e8 add preferredColumn field to app type 2024-10-18 06:44:45 +01:00