Commit Graph

89 Commits

Author SHA1 Message Date
d6e119a161 fix bug in line_gap.sml's 'deleteRightFromHere' function: when we reach end of buffer, return with current index and current line instead of setting these to 0, and return input leftString and leftLines when we reach the end, instead of an empty list for these fields, because all of our text content is in those values and it would disappear if we return empty lists instead 2025-09-22 15:06:36 +01:00
5b6b13278b remove unused arguments from 'moveLeft' and 'moveRight' functions in line_gap.sml, and adjust the callers of these functions so that they do not pass these parameters 2025-09-22 10:23:29 +01:00
d76ab0c3fe fix bug in line_gap.sml's 'lineNumberToIdxRight' function: when calling 'lineNumberToIdxRight', pass tails of 'rightStrings' and 'rightLines', instead of passing 'rightStrings' and 'rightLines' themselves, so that we advance through the list 2025-09-22 10:20:27 +01:00
8c56f9cc95 fix typo in line_gap.sml which caused a compilation error 2025-09-19 04:40:34 +01:00
7ea31ace35 add function to LineGap to get the index of a line number 2025-09-19 04:37:21 +01:00
749a0d0e5f better naming for a function in line_gap.sml, making it clear that it takes an index and returns the line number that this index is at. 2025-09-16 21:48:05 +01:00
bef4620cdb amend LineGap.append function: previously, we were calculating the updated textLength and lineLength, but we were not using them, instead passing the old parameters instead. Now we use them as well. 2025-09-16 05:36:26 +01:00
09fe611efb fix tracking of textLength and lineLength fields, which were previously buggy in only one delete branch; the current commit fixes that branch and verifies the tests pass 2025-09-14 15:48:26 +01:00
a95e90214d improve test reporting information a bit 2025-09-14 15:30:47 +01:00
1c59dbf943 implemented textLength and lineLength tracking in line_gap.sml: need to check if they are valid next 2025-09-14 15:23:53 +01:00
76dd6b2b2a begin tracking and adjusting textLength/lineLength for delete functions 2025-09-14 13:12:49 +01:00
eebf793fbf refactor test code to check if textLength and lineLength are also correct 2025-09-14 12:54:23 +01:00
92a98bfb56 update all functions in line_gap.sml to track textLength and lineLength, except for test code and delete functions 2025-09-14 12:41:50 +01:00
52f0da2751 refactor LineGap.append function to track textLength and lineLength 2025-09-14 12:27:11 +01:00
9927e6bf1c begin adding textLength and lineLength values in line_gap.sml (they are currently kept up to date only in the insert functions) 2025-09-14 12:22:15 +01:00
26862436d0 fix LineGap.goToLine bug: we weren't properly searching to check if the start of the searchLine was accessible in the node we stopped at 2025-09-13 17:58:42 +01:00
737e8695e7 fix bugs in helper functions for 'LineGap.getLineNumberOfIdx'. Main bug was that we were passing 'curLine' to 'getLineNumberRight' twice, instead of first passing 'curIdx' and then 'curLine' afterwards. 2025-09-13 04:55:27 +01:00
5c7ec252c2 don't index into line vector when getting line number from index; instead, just get how many previous-lines there are in the vector (if any) and add it to the line number of the current node. We do this because we are trying to get the line number of a particular index; accessing the line vector's contents (which are string indices) is not necessary nor helpful for that, but getting the relative line number is helpful for that 2025-09-13 03:51:33 +01:00
db6fd56aca perform bounds checking when we try to index into a vector, in LineGap's 'getLineNumberOfIdx' helper functions 2025-09-13 03:32:35 +01:00
5d2a2ef737 add function to get line number of LineGap to signature, so that it is available to callers 2025-09-11 18:01:19 +01:00
92006ae680 add functions to get line number (where first line is 0) to line_gap.sml 2025-09-11 17:59:03 +01:00
fe8d3906de fix regression introduced by previous commit (we need to be more careful when consing to 'leftStringsTl/rightStringsTl' than when consing to 'leftStrings/rightStrings', because our usage of consing the 'tl' variant in some places implies we have modified the head of that respective list 2025-08-05 16:17:53 +01:00
a2ca88da92 fix bug in index metadata in line_gap.sml (make sure we add and subtract by size of string by calling String.size) 2025-08-05 15:58:08 +01:00
50a7935612 minor change the nullSubstring function (use string literal for endWith parameter; no need to convert char to string) 2024-11-10 22:02:22 +00:00
6eb74c4332 add a substring function to line_gap.sml which is null terminated, which may be required for C FFI 2024-11-10 21:57:04 +00:00
c2e74d89fd fully implement substring for line_gap.sml 2024-11-10 11:13:12 +00:00
2cd6605ee4 progress adding substring to line_gap.sml 2024-11-10 10:41:41 +00:00
446e335f54 fix minor bug in 'helpGoToEnd' function in line_gap.sml (we were meant to pass rStrTl and rLnTl, but we were passing empty lists instead which caused us to lose data) 2024-10-30 10:53:17 +00:00
16f65c0d9d add 'goToEnd' function in line_gap.sml 2024-10-30 10:23:55 +00:00
d59d0bb17f fix starting 'goToLine' function in line_gap.sml; previously, we were comparing 'searchLine' to 'idx' to decide where to move buffer, but now we are comparing 'searchLine' to buffer's 'line' instead which is correct 2024-10-28 21:33:52 +00:00
d2e5c23c61 abstract reusable function from goToLine so it can be used in goToIdx, and implement goToIdx 2024-10-10 22:56:24 +01:00
d4ef45630d add function to move to specific line number (or the node containing a specific line number if node contains multiple line breaks) 2024-10-05 23:01:19 +01:00
36edbb6dee add function to go to start of line_gap.sml 2024-10-05 14:17:15 +01:00
2a5a5b0787 add append function to line_gap.sml 2024-10-05 12:39:45 +01:00
599252e5ed add function to create a LineGap.t from a string (although, for performance reasons, it's best to use this function when string is shorter than 1024 chars) 2024-10-05 00:57:12 +01:00
014c2ef7d1 add signature to line_gap.sml 2024-10-04 15:00:14 +01:00
98f93701fd clean line_gap.sml a little - done with this now 2024-07-20 14:41:51 +01:00
2fd0df641a remove debugging print statements from line_gap.sml 2024-07-20 11:31:31 +01:00
59ac0aded8 after amending a few more bugs, it seems that line metadata and index metadata are handled correctly. At least for svelte dataset; worth checking others as well 2024-07-20 00:52:49 +01:00
fa9e5567ca amend another idx metadata bug, but now there is another one 2024-07-20 00:28:25 +01:00
d71fd80398 amend few bugs - now there is another error with buffer having wrong index 2024-07-20 00:14:21 +01:00
f6c3a01b11 amend error with buffer having wrong index 2024-07-19 23:56:40 +01:00
26dff0c083 amend a bug to do with tabulating vector 2024-07-19 20:12:09 +01:00
05e3f3e2db amend a bug to do wth building wrong string output in line_gap.sml 2024-07-19 19:57:57 +01:00
34139e616b amend another Vector tabulate bug 2024-07-18 23:16:24 +01:00
120a84fd28 amend another bug 2024-07-18 22:41:54 +01:00
bd8edc3bf4 amend another bug 2024-07-18 22:27:41 +01:00
898249a1a8 amend bug 2024-07-18 22:19:29 +01:00
b227aa68ba save current status of file 2024-07-18 15:58:07 +01:00
371bc093ff fix bug revealed by checking for incorrect index metadta in line_gap.sml 2024-07-18 15:38:31 +01:00