|
|
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 |
|
|
|
0b0d5268fc
|
handle edge case when deleting by DFA: when we are deleting to the end of the file and if cursor is on first character after newline, then we also want to delete preceding newline too. Or else we will end up with two newlines at the end of the file, which is not what we want.
|
2025-09-23 07:18:58 +01:00 |
|
|
|
ec10f3e025
|
tiny amount of formatting
|
2025-09-23 07:04:41 +01:00 |
|
|
|
9174e4923c
|
don't deleteByDfa when buffer's length is 1, because that would mean that we would be deleting last newline in file
|
2025-09-23 07:04:20 +01:00 |
|
|
|
02ada5765b
|
improve 'MakeNormalDelete.deleteByDfa' function by refraining from deleting the unix-style line ending, if DFA takes us past the ending
|
2025-09-23 06:09:03 +01:00 |
|
|
|
cb0dec93a0
|
simplify implementation of 'MakeNormalDelete.deleteLine
|
2025-09-22 13:02:08 +01:00 |
|
|
|
e3148e6ac1
|
when deleting using a DFA motion, make sure we have a linebreak at the end so that we still have unix-style line endings as an invariant
|
2025-09-22 12:41:33 +01:00 |
|
|
|
351f7e9bf9
|
fix edge case with 'd$' motion: if deleting to end of file, we need to append two newlines
|
2025-09-22 12:28:08 +01:00 |
|
|
|
6f968ee8e5
|
in 'dk' motion, make sure we move the cursor to the start of the previous line in all cases
|
2025-09-22 09:46:43 +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 |
|
|
|
639f71009c
|
done reimplementing 'MakeNormalDelete.deleteLineBack', taking care of cases where we use this motion while on the first line or on the last
|
2025-09-21 16:40:05 +01:00 |
|
|
|
3ea44d9725
|
progress reimplementing 'NormalDelete.deleteLineBack' function
|
2025-09-21 15:45:14 +01:00 |
|
|
|
6af2b58b0f
|
make 'dl' motion (including count) call the same function as the 'x' motion, because they have identical behaviour.
|
2025-09-21 00:22:24 +01:00 |
|
|
|
2758b864bc
|
fix bug found by unit test: when deleting leftwards, we should never delete beyond the end of the line
|
2025-09-20 18:04:59 +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 |
|
|
|
dbf05ec8dc
|
refactor Cursor.viH to use DFA
|
2025-09-17 10:45:37 +01:00 |
|
|
|
9ddb5f68d7
|
fix bugs in vi-l-dfa (we want to stop looping when the counter is ~1, because the starting character will likely be final/a not-newline, and we want to loop at least once; also, we want to special case 'twoNewlineState' as a final case which causes us to go backwards by 1 instead of treating 'oneNewlineState' as a final/special case). We also modify other code to use the new vi-l implementation in the program.
|
2025-09-17 03:52:31 +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 |
|
|
|
12478f8ac2
|
remove references to 'Cursor.clipIdx' and delete that function once it is no longer used
|
2025-09-16 16:08:01 +01:00 |
|
|
|
19d2235686
|
refactor 'MakeNormalDelete.removeLineBreaks' function to remove function call to 'Cursor.clipIdx', instead relying on textLength field in buffer
|
2025-09-16 15:53:41 +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 |
|
|
|
3d9bf962e7
|
handle additional deleteLine edge case
|
2025-09-16 07:40:58 +01:00 |
|
|
|
70ffea21b3
|
fix the last MakeNormalDelete.deleteLine bug: if we delete such that the startIdx (prior to deletion) becomes longer than the text in the buffer, we move the cursor to the start of the last line
|
2025-09-16 07:01:55 +01:00 |
|
|
|
6507b9d49c
|
adjust MakeNormalDelete.deleteLine implementation slightly, because the previous implementation did not delete the last character when we are at the end of the file
|
2025-09-16 06:29:35 +01:00 |
|
|
|
9b34014af1
|
a few bug fixes to NORMAL_SEARCH_MODE: the main one is that we were passing the general searchString to the resize function before, and we were drawing the wrong string because of that; another bug fix is that, on resizing, we have to update the mode to contain the recalculated searchScrollColumn
|
2025-09-14 10:28:42 +01:00 |
|
|
|
0632f7a969
|
add horizontal scrolling functionality to SearchBar
|
2025-09-14 10:07:43 +01:00 |
|
|
|
f1a06f946d
|
add searchScrollColumn to NORMAL_SEARCH_MODE variant, and update and recalculate it where needed
|
2025-09-14 09:50:07 +01:00 |
|
|
|
428208f9bf
|
when text is wide enough to be centered, also centre the search bar
|
2025-09-14 09:14:22 +01:00 |
|
|
|
7a388f2983
|
add TextScroll function for centering line to cursor, and use it in 'NormalFinish.centreToCursor' function
|
2025-09-13 18:23:55 +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 |
|
|
|
bbe39f90d4
|
move cursor to low/cursorIdx in helper function
|
2025-09-13 08:48:00 +01:00 |
|
|
|
9208c47622
|
fix exception caused by resizing in normal mode: we were passing 'buffer' to the TextScroll function previously, but we were meant to be passing 'newBuffer'. We are passing 'newBuffer' in this new commit as we are meant to.
|
2025-09-13 05:31:11 +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 |
|
|
|
77a64ae794
|
previously forgot to draw char in text builder, but we do that now
|
2025-09-12 14:02:38 +01:00 |
|