summaryrefslogtreecommitdiff
path: root/input.c
AgeCommit message (Collapse)Author
2023-01-31Reimplement editor_prompt and 'Save as' using the new prompt modeHEADmastercflip
Now there there is a new way to prompt for text, we can reimplement the long abandoned editor_prompt function and use it to allow saving to new files. The new editor_prompt function takes a callback that will be called after the user presses enter on the prompt.
2023-01-31Rename the 'command mode' to 'prompt mode'cflip
Since this mode will also be used to accept input for setting the filename, searching for a string and possibly more, it makes more sense for this mode to be called prompt mode. There is also less ambiguity between normal mode because sometimes that is also called command mode.
2023-01-31Add a function to handle changing the editor modecflip
This way any extra stuff such as clearing the command line buffer or setting the flag to ignore the extra first key can be automatically set.
2023-01-31Start implementing editor commandscflip
This first step allows you to press the semicolon key to enter command mode, where you can type into a command line. Currently, pressing enter when in command mode will clear the command line but since there are no commands implemented it doesn't matter what you type in there.
2023-01-30Move unsaved quit warning to editor.ccflip
2023-01-28Change the keymap to use WASD for navigationcflip
This is a bit of a silly experiment, but it already feel pretty comfortable to have all text nagivation commands on the left hand and manipulation commands on the right hand.
2023-01-17Rename 'rows' to 'lines' everywherecflip
For whatever reason lines were called rows in the code, so this refactor changes that name everywhere. The name 'row' is still used in some places to refer to the unit of height in the screen.
2023-01-16Ignore first keypress after entering insert modecflip
This fixes the problem where the key used to enter insert mode ('i' for example) would also be typed into the document.
2023-01-16Implement some more commands from vimcflip
2023-01-12Manually insert tab characterscflip
Tabs don't show up in the text input event for whatever reason so they need to be manually inserted.
2023-01-12Make the editor modal and refactor keyboard eventscflip
This makes the editor behave more like vi, with a seperate insert mode. This also refactors the keyboard input code to pass the SDL_Keysym structure to input.c and to use the SDL_TEXTINPUT event for editing text. SDL's text input event already fixes typing capital letters with shift, and should make it possible to enter text using an IME, however most unicode characters aren't properly rendered.
2023-01-12Move cursor movement into separate functionscflip
2023-01-11Remove all terminal-related codecflip
2023-01-09Implement basic keyboard event handlingcflip
2023-01-08Initial import of existing source codecflip
This is based off of snaptoken's "Build Your Own Text Editor" tutorial at https://viewsourcecode.org/snaptoken/kilo/.