Y
Hacker News
new
|
ask
|
show
|
jobs
by
austy69
88 days ago
Fun read. Wonder if you are able to edit text in the shell, or if you need to implement a gap buffer to allow it?
1 comments
healeycodes
88 days ago
Editing the current line works because I brought in
https://man7.org/linux/man-pages/man3/readline.3.html
towards the end so I could support editing, tab completion, and history.
IIRC readline uses a `char *` internally since the length of a user-edited line is fairly bounded.
link
austy69
88 days ago
Very cool. Currently working on the beginning of a small text editor so this part seemed interesting and was curious of any overlap. Thanks for the interesting post!
link
zokier
88 days ago
worth noting that you get basic line editing for "free" from kernels tty subsystem even if you don't use readline.
link
1718627440
87 days ago
Yes, but it is really basic. Is it more than backspace? Most cursor key presses are just forwarded to the program as escape sequences.
link
IIRC readline uses a `char *` internally since the length of a user-edited line is fairly bounded.