aboutsummaryrefslogtreecommitdiffstats
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
2024-01-12Introduce new helper functions for creating ropes.Rose Hogenson1-32/+27
2024-01-12Remove an unnecessary clone.Rose Hogenson1-1/+1
2024-01-12Handle Interrupted errors during read.Rose Hogenson1-2/+10
2024-01-12Apply a clippy suggestion.Rose Hogenson1-2/+6
2024-01-12Simplify the Rope::leaf function.Rose Hogenson1-9/+8
2024-01-12Remove unnecessary function from_slice.Rose Hogenson1-11/+7
2024-01-12Simplify the code a little bit.Rose Hogenson1-14/+10
2024-01-12Try to avoid copies.Rose Hogenson1-42/+72
2024-01-12Start tuning the performance of rope.Rose Hogenson3-57/+54
2024-01-12Support the delete key.Rose Hogenson1-0/+4
For now it's exactly the same as backspace.
2024-01-12Allow 4~ for End.Rose Hogenson1-1/+1
This seems to be what GNU screen provides, at least.
2024-01-12Fix a bug where cursor_pos would return old data.Rose Hogenson2-148/+186
For now I'm just counting the failures, and aborting if cursor_pos immediately failed before. We have to skip the incoming status reports with read_key before cursor_pos will start working again. This should flush any old status reports, and prevent reading them incorrectly.
2024-01-11Implement Home, End, PgUp, and PgDn.Rose Hogenson3-22/+117
2024-01-11Apply a clippy suggestion.Rose Hogenson1-1/+1
2024-01-11Don't call read immediately in cursor_pos.Rose Hogenson1-2/+1
I forgot that read can block. We actually don't want cursor_pos to block for user input before querying, since it will fail nearly every time. It did give me a good opportunity to test the error handling though.
2024-01-11Keep the cursor position on error.Rose Hogenson1-8/+9
Now it handles errors so well! You can barely tell that nearly all of the calls to cursor_pos are failing.
2024-01-11Do a little more to handle errors.Rose Hogenson1-1/+7
2024-01-11Don't read the wrong value in cursor_pos.Rose Hogenson1-0/+6
It seems like sometimes a slow terminal like lxterminal can take a little while to respond with the cursor position, so the read can time out. If it does, a later call to cursor_pos could read it in. To prevent this, we can call read before even querying the position. If there are any previous pending status responses, this should hopefully read them in, and we can abort early without getting confused. If there is no buffered data on stdin, then it's hopefully safe to write the status query and read the response.
2024-01-11Optimize for ASCII case in floor/ceil_grapheme.Rose Hogenson1-1/+4
2024-01-11Optimise line_offset for the ASCII case.Rose Hogenson2-0/+38
In most cases we really won't need the full binary search. We can check quickly for ASCII without ever printing anything, and fall back to binary search if we find any Unicode characters.
2024-01-11Fix the cursor behavior at line endings.Rose Hogenson1-4/+6
2024-01-11Rewrite the entire thing.Rose Hogenson3-746/+754
They say you can always do a better job on the rewrite, and to a certain extent that was true here. I kept a lot of it the same though, since there was a lot I liked from the original design. The main improvements are in efficiency and code clarity.
2024-01-07Support backspace in xterm.Rose Hogenson1-1/+3
Backspace: Cooler backspace:
2024-01-07Be more efficient with full screen refreshes.Rose Hogenson1-2/+15
xterm has some bad flickering if I just naively repaint the whole screen every time. We can easily track whether we need to repaint the whole screen or just the line.
2024-01-07Make undo a bit less weird.Rose Hogenson1-17/+22
2024-01-07Support pasting text into the editor.Rose Hogenson2-108/+171
The editor only repaints when there is a small delay in the input, which only happens when the user is typing. Otherwise the bytes go straight into the buffer.
2024-01-07Avoid an extra copy.Rose Hogenson1-11/+7
2024-01-07Implement redo.Rose Hogenson2-49/+86
Is this how redo works?
2024-01-06Implement undo.Rose Hogenson2-12/+46
2024-01-06Use a b-tree for the rope.Rose Hogenson3-160/+352
Now it's balanced :D
2024-01-06Fix some bugs with long lines.Rose Hogenson2-41/+8
2024-01-06Implement backspace.Rose Hogenson3-5/+23
2024-01-06Fix input issues when scrolling quickly.Rose Hogenson2-17/+31
Unfortunately the user input comes on the same channel as the terminal status report from 6n, so there's a possibility of getting confused here. As long as the program is relatively efficient, it shouldn't be observable.
2024-01-06Support inserting newline.Rose Hogenson2-37/+91
2024-01-06Allow scrolling up and down.Rose Hogenson2-13/+23
2024-01-06Truncate long lines.Rose Hogenson2-22/+58
2024-01-06Wrap the cursor around at the ends of a line.Rose Hogenson1-5/+12
2024-01-06Use more idiomatic error handling.Rose Hogenson3-178/+82
2024-01-06Fix unicode handling.Rose Hogenson2-68/+212
It's hard to say if this counts as "fixed," but I think it's at least better than GNU nano.
2024-01-05Clean up the rope code.Rose Hogenson2-216/+139
2023-12-29Allow saving the file with CTRL-S.Rose Hogenson3-1/+29
2023-12-29Support inserting text.Rose Hogenson3-6/+71
2023-12-29Keep track of cursor position.Rose Hogenson2-31/+172
2023-12-29Allow moving the cursor with the arrow keys.Rose Hogenson2-20/+82
2023-12-27Wait for ctrl-q to exit.Rose Hogenson1-9/+26
2023-12-27Add some TODOs for important enhancements.Rose Hogenson1-0/+2
2023-12-27Wait for keypress before exiting.Rose Hogenson1-2/+17
2023-12-27Handle error from putting terminal in raw mode.Rose Hogenson1-1/+6
2023-12-27Print each line separately.Rose Hogenson2-28/+20
Now that the terminal is in raw mode, we need to also include \r after each line.
2023-12-27Put the terminal in raw mode.Rose Hogenson2-11/+56