Commit Graph

191 Commits

Author SHA1 Message Date
4925bcd370 for LineGap.lineNumberToIdx function, add a branch at the start checking if we are trying to get the idx corresponding to line number 0. This is needed by the current implementation because the 'lineNumberToIdxLeft' function uses (findLine - 1) in the implementation, and (0 - 1) is an invalid line idx as it is below 0. 2025-12-02 23:49:29 +00:00
4126c833d1 add functions to replace start and end leaves in rrb_rope.sml 2025-10-23 06:41:21 +01:00
6f406069a8 add function to split right of vector 2025-10-23 06:33:48 +01:00
f9f602bb9f add function to split left side of tree, given an index 2025-10-23 06:23:30 +01:00
7c9d47346e begin implementing clojure-style vector first as a rope implementation of radix-relaxed balanced trees 2025-10-23 05:11:57 +01:00
ec62efb40c add 'textLength' value to line_gap.sml's string_iterator, and remove function to check if iterator is t end 2025-10-08 06:49:39 +01:00
1d6213636e add function to line_gap.sml to check if iterator is at end 2025-10-08 06:24:40 +01:00
7248a3e27f add function to get a char from a string_iterator in line_gap.sml 2025-10-08 06:17:01 +01:00
3345f618ca progress making string iterator for line_gap.sml 2025-10-08 06:12:40 +01:00
56a469e578 handle edge case in line_gap.sml when deleting to the left: we sometimes need to delete to the end of the string, so add a branch handling that case 2025-10-06 22:56:18 +01:00
265e6e1a90 fix bugs in 'LineGap.subRight' (we were not passing nextIdx in recursion properly) 2025-09-30 05:23:31 +01:00
14bb447289 fix known errors in LineGap.sub function 2025-09-29 22:29:28 +01:00
863b4ba47b do not require pattern matching head when in subRight/subLeft loop, but only require that in some cases 2025-09-29 22:13:03 +01:00
6de33a65c2 fix minor type error introduced in line_gap.sml in last commit (was returning an integer instead of a char) 2025-09-29 22:03:36 +01:00
f4422cc36c add function to line_gap.sml to retrieve a single specific char 2025-09-29 21:56:39 +01:00
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
a84490c86c use parametric polymorphism for value in gap_map.sml, instead of specifying value via functor. This is more flexible because a type which is defined after the functor can be used with the map. (The key in gap_map.sml is still specified by functor, though, which is necessary because the structure uses comparison functions which work with the key.) 2025-03-12 23:25:29 +00:00
e2da10e908 amend 'removeMiddle' function in gap_map.sml: before, we were leaving element we want to remove in rkhd/rvhd because we started the slice at 'insPos', but now we increment 'insPos' by 1 so we filter that desired element out 2025-02-14 13:02:42 +00:00
5f834ddaa4 add functor to fold over GapMap in gap_map.sml 2025-02-13 12:40:27 +00:00
f3cc41e9a2 add 'env' parameter to gap_map.sml's mapper 2025-02-13 12:06:20 +00:00
9c32e53160 add 'env' parameter to gap_map.sml's mapper 2025-02-13 12:01:40 +00:00
aa127b28fd add 'env' parameter to gap_map.sml's mapper 2025-02-13 12:01:07 +00:00
9749abf1d5 add 'env' parameter to mapper in gap_map.sml 2025-02-13 11:56:12 +00:00
d23396f5d1 cover exhaustive case reported in gap_map.sml (in 'joinSlices' function), and make it possible to map over values by using a functor 2025-02-13 10:52:55 +00:00
ae3238eabe minor adjustments to gap_vector.sml to make functor fit GAP_VECTOR signature 2025-02-13 08:26:48 +00:00
cfce329255 add gap_vector.sml, which is just the same as gap_buffer.sml, except generic through the use of functors 2025-02-13 08:22:55 +00:00
33678f2b0d code 'remove' function for gap_map.sml, completing the functionality I need for GapMap (but warning that, although most functions were edited from gap_set.sml, gap_map.sml is entirely untested) 2025-02-13 03:21:18 +00:00
2c187d0e87 implement 'moveTo' function for gap_map.sml 2025-02-13 02:41:29 +00:00