cde4dbc67f
reduce unnecessary intermediary allocations in app-update.sml's 'helpDeleteToChr' function, similarly to previous commit
Humza Shahid2024-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
Humza Shahid2024-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)
Humza Shahid2024-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
Humza Shahid2024-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.)
Humza Shahid2024-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
Humza Shahid2024-11-09 03:51:39 +00:00
e1b5352cfb
add todo notes for 'parseDelete' function
Humza Shahid2024-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
Humza Shahid2024-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)
Humza Shahid2024-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
Humza Shahid2024-11-08 20:43:36 +00:00
c080b913ae
reorganisation app-update.sml to place related functions close together
Humza Shahid2024-11-08 18:36:02 +00:00
4574a23dc8
extract reusable function 'buildTextAndClear' (but need to be careful since some functions have specialised build functionality and shouldn't use this function)
Humza Shahid2024-11-08 18:27:55 +00:00
f7c99530ae
rename function for vi's 'x' command from deleteChr to removeChr, because it helps avoid confusion with motion-based delete (for example, 'dw')
Humza Shahid2024-11-08 15:27:16 +00:00
6e66d4c968
done with imperative shell/ffi aspect of sending KEY_ESC to update thread when that action has occurred
Humza Shahid2024-11-08 09:46:01 +00:00
a4dea7626f
add KEY_ESC message type, and refactor app-update.sml to use it (always calls 'clearMode' function which always sets the app to normal mode, and sets the command strnig to empty)
Humza Shahid2024-11-08 09:30:57 +00:00
ff38e39deb
do not use 'clearMode' in helpDeleteChr function, because we have 'buffer' and 'cursorIdx' parameters we would like to add to the app state before exiting the loop. Instead, go to end of loop by passing 'count' of 0
Humza Shahid2024-11-08 04:25:33 +00:00
36763fce94
add count to 'x' command, allowing [count] chars to be deleted
Humza Shahid2024-11-08 04:21:05 +00:00
81c516e907
fix very minor issue in cursor.sml's 'helpViL' function (previously returned cursorIdx when non-line breaks is followed by non-line break, but now return cursorIdx + 1 instead which is the correct behaviour, because we want to move the cursor rightwards one position in that case
Humza Shahid2024-11-07 21:07:11 +00:00
fdb6e0292a
fully done amending 'getCursorColumn' in cursor.sml it seems, because all the inputs I throw at it give the expected results
Humza Shahid2024-11-07 21:00:56 +00:00
63f2945334
restore triple-line checking to 'startViK' in cursor.sml, as it seems safer
Humza Shahid2024-11-07 20:51:02 +00:00
a77003e348
seem to have viK and viJ fixed for the moment, except when I delete from the first or second line with 'x' (deleting from other lines does not seem to make a difference)
Humza Shahid2024-11-07 12:59:03 +00:00
a35c0803fb
fix 'getStartLineBefore' in text-window.sml, where we always decrement 'lineNum' variable when encountering \n, and use 'Int.max (lineNum - 1, 0)' to clip lineNum to 0 if it happens to go below 0
Humza Shahid2024-11-07 11:57:32 +00:00
c07afee77f
simplify one part of cursor.sml's 'startViK' function, by calling 'helpVi0' rather than 'helpViK' when we know previous char is \n
Humza Shahid2024-11-07 11:46:30 +00:00
9f0982ad91
simplify viK and especially startViK in cursor.sml, by only checking (strIdx - 1) and (strIdx - 2)
Humza Shahid2024-11-06 19:47:14 +00:00
6b9cf8dbc2
amend problem with TextWindow.getStartLineBefore, where we were not following rule mentioned in previous commits to not count (graphical-chr -> \n) as line break
Humza Shahid2024-11-06 12:46:53 +00:00
50d10c1a89
delete-chr (equivalent of vi's 'x' cmd) works fine now, except when deleting from the very first line, where first line may become invisible temporarily. I am not sure why that is happening but will find out.
Humza Shahid2024-11-06 12:17:26 +00:00
2e13030efb
handle more edge cases of viK (and it is now complete)
Humza Shahid2024-11-06 11:52:40 +00:00
62d62a8429
rewrite viK in accordance with previous commits
Humza Shahid2024-11-05 21:42:56 +00:00
7f1e5249f0
rewrite Cursor.viJ and Cursor.helpViJ for new line break scheme
Humza Shahid2024-11-05 20:25:08 +00:00
b396a1b36b
minor fix in Cursor.viH: if strIdx is not in hd of rightStrings, check tl of rightStrings
Humza Shahid2024-11-05 19:50:36 +00:00
0315bd6550
rewrite Cursor.viH for new line-break-skip scheme, as mentioned in previous commit
Humza Shahid2024-11-05 19:44:49 +00:00
b0a37c5c56
new task: rewrite basic cursor.sml functions (h, j, k, l) to look for 'is line break preceded by non-line break?' rather than 'is there a double line break?' because the second question which is already implemented has buggy behaviour on triple line breaks, where cursor does not go to the place user expects. Currently, on Cursor.viL has been rewritten to match the first question.
Humza Shahid2024-11-05 13:14:52 +00:00
9df6f92a33
progress with equivalent of vi's 'x' command
Humza Shahid2024-11-05 12:38:01 +00:00
a0a8fcc17b
change line indexing in AppUpdate.moveToLine from 0-based to 1-based (so first line can be access with 1G, second with 2G, as is normal with Vim)
Humza Shahid2024-11-04 02:56:57 +00:00
66d4346c74
improvement in Cursor.getLineStartIdx when going to last line in buffer
Humza Shahid2024-11-04 02:46:02 +00:00
b368619df3
add functionality to go to specific line in buffer
Humza Shahid2024-11-02 13:59:55 +00:00
2df8f88452
improvements to TextWindow.isCursorVisible (no need to do binary search; in fact, that leads to an exception, because we are meant to use Vector.sub to access the relative line instead)
Humza Shahid2024-11-02 12:54:34 +00:00
2a8e02ff3a
when pressing fcore/text-window.sml to match pair, only recentre text window if matching pair is not currently visible on screen
Humza Shahid2024-11-02 12:34:23 +00:00
33f2bf7b58
partial implementation of TextWindow.isCursorVisible
Humza Shahid2024-11-01 03:44:12 +00:00
f7b755d6a6
fix minor bug in cursor.sml (we checked if strPos is equal to 'String.size str - 1' but then accessed strPos + 1, which makes our bound check useless and may cause an exception. Instead, check 'strPos < String.size str - 1'
Humza Shahid2024-11-01 03:35:12 +00:00
25f06b1f9a
fix minor bug in Cursor.matchPair fuunction; depending on chr at strIdx, we might want to iterate on the leftStrings or on the rightStrings. Before, we iterated on the rightStrings only, but now we iterate on whichever is appropriate
Humza Shahid2024-10-31 11:50:18 +00:00
fe317ca220
add missing implementation of Cursor.matchPair when strIdx is in tl
Humza Shahid2024-10-31 11:19:10 +00:00
1316cdfe13
fill in todo where strIdx is in tl, in text-window.sml function 'getStartLineWithCursorCentered
Humza Shahid2024-10-30 11:12:12 +00:00
601a341992
add functionality to move to end of line
Humza Shahid2024-10-30 10:54:55 +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)
Humza Shahid2024-10-30 10:53:17 +00:00
16f65c0d9d
add 'goToEnd' function in line_gap.sml
Humza Shahid2024-10-30 10:23:55 +00:00
308d042deb
add functionality to centre text window to cursor
Humza Shahid2024-10-30 10:05:16 +00:00
c7570707ab
100fcore/app-update.sml done with functionality of getting screen to move (if needed) when cursor moves, including getting screen to move when moving to a new chr (in this commit)
Humza Shahid2024-10-28 23:06:32 +00:00
5e1e39ca69
fixed two issues. First is that an exception occurred when sometimes moving cursor forwards. Cause of this issue was that callee functions depended on LineGap being moved to start of line, but this did not always happen (and now it does always happen). Second issue was that moving cursor down did not scroll as expected when line wrapped. The reason for this second issue was that the 'getStartLineAfter' function did not increment 'startLine' value in loop when line wrap occurred. Both issues are now fixed.
Humza Shahid2024-10-28 22:54:28 +00:00
bff4c006ed
have functionality for cursor to scroll down a line when cursor moves down one line working, but it only seems to work perfectly when there are no visual line breaks
Humza Shahid2024-10-28 21:56:07 +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
Humza Shahid2024-10-28 21:33:52 +00:00
0ed5a23ade
some progress moving textWindow, but it is not perfect yet
Humza Shahid2024-10-28 10:59:18 +00:00
4b1ee33954
begin moving text window when cursor goes off screen (currently, we only move the window when cursor goes backwards but this works fine and as expected)
Humza Shahid2024-10-28 09:34:55 +00:00
deab30c46d
add equivalent of vi's 'ge' and 'gE' commands
Humza Shahid2024-10-28 06:52:58 +00:00
22f7c7f8c3
return nonLastLine from helpTillPrevChr function
Humza Shahid2024-10-27 02:45:15 +00:00
01213fb2fb
fix bug with tillNextChr which would place cursor on a newline
Humza Shahid2024-10-26 16:20:24 +01:00
eeacde8e7a
address edge case when '0' is input, because '0' may either be a count if some number preceded it, or else it is a command to go the start of the line
Humza Shahid2024-10-26 11:04:04 +01:00
62a9aaaaab
progress with moving cursor to specific char (vi's 't' command and vi's 'f' command)
Humza Shahid2024-10-26 10:47:45 +01:00
50a0a3e31b
begin preparation to remove 'word_type' datatype in cursor.sml, which will simplify implementation of word motions
Humza Shahid2024-10-24 13:13:49 +01:00
a454524ecc
reimplement part of non-recursive start function 'viK' in cursor.sml
Humza Shahid2024-10-22 09:46:29 +01:00
dd71dda9f2
in start of cursor.sml's viK function, use vi0 function if cursor is at newline, so there's no need to worry about or track column
Humza Shahid2024-10-22 07:06:16 +01:00
b22222cf5d
implement vi0 and viDlr (viDlr = function called when pressing $), which both work fine
Humza Shahid2024-10-21 03:04:47 +01:00
e08f2c4f77
add implementation of viK, completing hjkl movement keys
Humza Shahid2024-10-21 01:34:54 +01:00
d8e1c9d0fd
in cursor.sml's 'viJ' function, make sure to call helpViJString with nest str hd/tl, when strIdx is in the strTl
Humza Shahid2024-10-20 21:58:58 +01:00
6b3d322c1c
progress with viJ to move cursor downwards
Humza Shahid2024-10-20 21:30:06 +01:00
47f4d452fe
amend error in cursor.sml's 'getCursorColumn' function, where we may need to check tail of string to start convert cursorIdx to relative strIdx
Humza Shahid2024-10-19 23:04:26 +01:00
e0f44fc8ea
better handling of double linebreaks in cursor.sml's viH function
Humza Shahid2024-10-19 07:24:27 +01:00
7fd59c734a
add function to retrieve column that cursor is on, relative to line
Humza Shahid2024-10-19 07:03:32 +01:00
92b834427c
code 'viH' function to move leftwards by one char
Humza Shahid2024-10-18 00:40:43 +01:00
19073cb56c
improve code to move rightwards in cursor.sml (making it clearer with comments), and improve code to draw cursor at newline in text=builder.sml
Humza Shahid2024-10-17 08:40:28 +01:00
0299a9e6b2
draw cursor at newline linebreaks (only \n though and not \r\n)
Humza Shahid2024-10-17 06:25:43 +01:00
766ab6787c
in viL function, use 'cursorIdx + 1' instead of 'bufferIdx + ...' because what we want is to increment the cursor by one index, rather than to move the cursor to the end of the hd
Humza Shahid2024-10-17 03:17:57 +01:00
21652a5381
in TextBuilder, forgot to build cursor when cursorIdx is over space, so now we build cursor when cursorIdx is over space
Humza Shahid2024-10-17 02:14:09 +01:00
c77777cc09
add CHAR_EVENT message type (next is to handle hjkl navigation)
Humza Shahid2024-10-17 01:38:31 +01:00
ed33cf97a4
receive new version of brolib, which has new goToIdx function which will be useful for hjkl navigation
Humza Shahid2024-10-10 22:58:05 +01:00