Commit Graph

41 Commits

Author SHA1 Message Date
e44eae6d46 reimplement 'f' move motion more efficiently, not leaving the LineGap.t data structure while iterating to next count 2025-10-18 14:01:06 +01:00
0de7a9278a progress implementing help-prev-match for vector 2025-10-08 10:27:19 +01:00
8941ce9f89 reimplement functionality to search forwards using 'n' command 2025-10-08 08:10:51 +01:00
fd321c2f14 fix some type errors 2025-09-29 15:02:40 +01:00
9a15b1715a pass all tests for 'j' motion 2025-09-23 15:30:28 +01:00
95a4f109bd progress reimplementing 'j' motion to pass new tests 2025-09-23 15:22:49 +01:00
fcc8c8085a reimplement 'G' motion so that it follows new rule (cursor goes to second-last chr if last chr is a newline preceded by a non-newline, but goes to last chr otherwise) 2025-09-23 11:57:19 +01:00
4f20379219 take care of a few tests after refactoring/making a different design decision 2025-09-23 11:04:47 +01:00
961ce63023 begin refactoring to let cursor move to very last char of file (including unix line ending) 2025-09-23 10:50:10 +01:00
8931d4d071 fix minor compilation error introduced in previous commit 2025-09-23 09:29:02 +01:00
ec462a4df7 remove special case from 'k' motion: the exact semantics we want for trailing newlines at the end of a file are currently a bit unclear and require exploration 2025-09-23 09:27:13 +01:00
505521f5e2 minor cosmetic change 2025-09-23 09:04:18 +01:00
c9365076ad handle special case with 'k' motion: when file ends with \n\n and cursor is on first \n: we should be able to move upwards from here too 2025-09-23 08:54:19 +01:00
e6ea96f995 fix bug in 'k' motion: when we move from any other line to line 0, always unconditionally decrement column by 1 2025-09-22 07:02:20 +01:00
3128647a5f reimplement 'k' motion so that newlines which are immediately preceded by non-newline chars are skipped 2025-09-22 06:49:00 +01:00
5315aff600 reimplement 'j' motion so that newline is skipped only if immediately preceded by char 2025-09-22 05:32:03 +01:00
c29afbdb7c fix minor bug regarding 'NormalMove.moveCursorDown': after a <count-j> that moved the cursor to the last line in the buffer, the cursor would be at the last column too, even if that wasn't the previous column. To address this issue, we take out code that calculates the lineIdx from the 'NormalMove.finishMoveCursorUpDown' function, and have both 'NormalMove.moveCursorUp' and 'NormalMove.moveCursorDown' calculate their own lineIdx in different ways and pass it to the 'NormalMove.finishMoveCursorUpAndDown' function. 2025-09-20 02:58:51 +01:00
090e7ccea2 pass 'maxLength' value to TextScroll function so that we can prevent scrolling past the bottom of the file (unless we want to od so by centtering the screen) 2025-09-19 23:17:28 +01:00
d3fa4d08bf extract reusable function containing common code previously used in both 'NormalMove.moveCursorUp' and 'NormalMove.moveCursorDown' functions, and make them call the reusable function instead 2025-09-19 22:40:29 +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
9ec8891ce5 fix bugs in new function for moving cursor upwards, taking care to calculate column different if on first line (where there is no preceding newline) vs any line other than the first 2025-09-19 05:23:20 +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
e4e3961d41 in NormalMove.moveToLine function, use new LineGap function, 'LineGap.lineNumberToIdx', to get the index a line is at, and delete the Cursor.getLineStartIdx' function which we no longer need, as that functionality is in brolib-sml itself. 2025-09-19 04:45:29 +01:00
b6244d4962 amend motion to move to a line: if the requested line has a linebreak as the next character after it, stay at the current position, or else add 1 to the linebreak's idx so that we go to the first character of the line 2025-09-19 04:03:54 +01:00
1adb74df2c pull in new brolib-sml changes (which just changes one particular function's name to be clearer), and modify code to use the correct name 2025-09-16 22:20:55 +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
148b108062 when using 'G' command to move to end fo file, use the 'textLength' field to calculate the new bufferIdx, which is more sensible than using the LineGap's idx for the same purpose 2025-09-16 07:52:47 +01:00
18d2579605 remove todo-exception from 'G' (NormalMove.goToEnd) command. The todo was a reminder to implement a way to get the scroll line when moving to the end. We have that implemented now. 2025-09-13 18:15:30 +01:00
668dd07699 pull in new version of brolib-sml so that we can get bug fixes for LineGap.getLineNumberOfIdx, delete the TextWindow structure (which was previously used to get the start line to draw from), and replace previous usages of TextWindow with TextScroll.getStartLine. This enables us to scroll in a way tailored to the reimplemented TextBuilder (which do not wrap lines or characters) 2025-09-13 05:12:17 +01:00
a99b6c8df8 implement smoother horizontal scrolling. If the new column is already visible without changing the previous scroll column, then don't change. If the new scroll column is prior to the old, then scroll backwards; else, scroll forwards. 2025-09-13 01:43:31 +01:00
422d6ad9ac fix bugs in implementing and using text buffer. Some functions did not save the drawMsg to the app's state, which we means we didn't draw in those cases. The text builder functions also drew cursors on characters even when the cursor is not at this position. Both of these bugs are fixed. 2025-09-12 23:21:53 +01:00
2ad7623848 fix further compiler errors 2025-09-12 13:47:14 +01:00
052f0efe16 fix compiler errors for normal-move.sml 2025-09-12 13:23:46 +01:00
8698333f5b refactor to make sure that we count the visual scroll column on move/delete, in normal mode 2025-09-11 23:43:09 +01:00
a86befdea8 a bit of refactoring 2025-08-31 06:28:05 +01:00
c4f3e921a3 formating 2025-08-20 12:51:31 +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
1bdf8e457b implement 'deleteInside' motions 2025-08-07 19:12:01 +01:00
14f97ecc57 done refactoring normal mode functions 2025-08-07 18:09:52 +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