Commit Graph

100 Commits

Author SHA1 Message Date
542da2229c a little additional scaffolding for normal mode 2025-08-31 02:41:37 +01:00
3b6dff3081 begin scaffolding NormalSearchMode (normal mode, except we are searching) 2025-08-31 02:10:57 +01:00
c21d1b8205 progress fixing compile errors resulting from adding 'bufferModifyTime' field (fixed normal-mode move expressions) 2025-08-20 12:50:39 +01:00
14f97ecc57 done refactoring normal mode functions 2025-08-07 18:09:52 +01:00
f63e416e8f move normal-mode deletion functions to their own file 2025-08-07 18:02:47 +01:00
85c0b09d26 put cursor-movement functions in their own file 2025-08-07 17:57:47 +01:00
bc188b9175 begin refactoring (split app-update into different files) 2025-08-07 17:41:10 +01:00
73affaa83a instead of clearing the search list when we delete, build a small part of it by searching through a small part that is likely to be visible on the user's screen, which gets rid of flickering effect and makes it look like the search list is not rebuilt from scratch 2025-08-07 15:37:32 +01:00
27c5d11dd7 code functions to build search list from a range in the buffer (not searching for every single match, but searching for visible matches on user's window) 2025-08-07 15:28:29 +01:00
30036177fb remove calls to retrieve 'lineIdx' values which are never used 2025-08-07 14:42:40 +01:00
da2d2f1b55 add functionality to delete to/until prev match 2025-08-07 13:37:03 +01:00
5d6dbb0403 add functions to move to prev/next match 2025-08-07 13:22:10 +01:00
704854c80f use concurrency for rebuilding search list after deletion so we don't block main thread on very, very large files 2025-08-07 12:20:57 +01:00
fab8cfcf20 change representation of search list to be a plain int vector and not a zipper (I am not using it for incremental purposes anyway so no point using a zipper) 2025-08-06 00:42:24 +01:00
e06a27d5ad delete some dead code 2025-08-06 00:30:50 +01:00
f0f28a1318 clean up some dead code 2025-08-06 00:16:50 +01:00
229bf59f5d pass correct variable as argument ('startIdx' instead of 'cursorIdx') 2025-08-04 10:46:24 +01:00
ce0f700253 abstract exception handler/logger into its own file 2025-08-04 09:03:47 +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
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
deb24c2063 with cursor movements, instead of passing in functions as parameters (callbacks/higher order functions), functorise the cursor movement functions instead so we can take advantage of defunctorisation and avoid the runtime cost of closures/higher order functions/function pointers 2025-01-09 22:30:51 +00:00
90f8732f06 move msgs into AppType.app_type, and refactor AppUpdate.update function to have type (app_type -> app_type) instead of pervious case which was (app_type -> app_type * MailboxType.t list). Reason: no need to allocate/return tuple when can store messages in type directly; previous msg list will be reset after each app update. All tests after refactor are passing. 2024-12-17 10:40:06 +00:00
c28dc429b7 address todo in text-builder.sml by adding prerequisite: always call SearchList.goToNum before calling TextBuilder.build 2024-11-25 04:37:47 +00:00
04d4e013e2 ensure that searchList is deleted from when calling delete functions other than 'helpRemoveChr' 2024-11-23 06:10:40 +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
e90df37b43 in search-list.sml: fix 'delRightFromHere' and 'delLeftFromHere' functions which joined newHd with left/right, rather than the tl, and therefore added new numbers to the list, which is incorrect behaviour. Fixed this by using joining with 'tl' rather than left/right. In build-search-list.sml: make fromRange function return tuple instead of an instance of app. Finally, in app-update.sml: progress towards refactoring 'helpRemoveChr' function to map and delete from searchList as desired. 2024-11-17 09:25:01 +00:00
f2b4f256ec bugfix: in search-list.sml's 'delRightFromHere' function, make sure we preserve the last part of the vector when finish < last 2024-11-16 09:05:47 +00:00
436b3e0d92 simplify and rewrite function 'del' in search-list.sml 2024-11-16 08:33:26 +00:00
c0c1a7c885 refactor app-update.sml to pass additional parameters to TextBuilder.build 2024-11-15 08:24:48 +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
5294da6780 use 'Cursor.clipIdx' in app-update.sml's 'helpDelete' and 'helpDeleteLine' functions, to ensure we never delete last line (unix text files always end with \n) 2024-11-10 07:57:49 +00:00
6e4f6b58b9 done with 'parseDelete' functionality in app-update.sml': have all the delete commands I would like 2024-11-10 07:51:12 +00:00
58a9c2ec69 add functionality for commands: 'dgg' (delete from cursor to start of buffer), 'dge' (delete from cursor to the end of the previous word) and 'dgE' (delete from cursor to the end of the previous WORD) 2024-11-10 07:34:30 +00:00
bc27925e75 similar loop optimisations described in previous commit to app-update.sml's 'helpDeleteToChr' function 2024-11-09 10:49:54 +00:00
fed827a6c9 same loop optimisation mentioned in previous commit to app-update.sml's 'helpDelete' function 2024-11-09 10:41:37 +00:00
dece4d4d83 break out of loop early in 'helpMove' and 'helpMoveToChr' functions, in case where calling 'fMove' returned the same value as before 2024-11-09 10:11:51 +00:00
cde4dbc67f reduce unnecessary intermediary allocations in app-update.sml's 'helpDeleteToChr' function, similarly to previous commit 2024-11-09 09:59:12 +00:00
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