summaryrefslogtreecommitdiff
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-31Add functions to delete and clear a textbufcflip
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-25Rename `append_buffer` to textbufcflip
This name is a little bit better I think, and it will be nice to have a distinction between this utility and the 'file' kind of buffer.
2023-01-25Use Glypher as the official name of the editorcflip
2023-01-22Add an uninstall rule to the Makefilecflip
2023-01-22Remove unused `editor_draw_rows` functioncflip
This was used to draw all visible lines into a buffer to be rendered by the terminal or window, but now the window draws these lines directly.
2023-01-19Add an install command to the Makefilecflip
2023-01-19Load gzipped fonts from /usr/local/share/consolefonts/cflip
The editor now loads fonts from /usr/ instead of the current working directory. Since they are gzipped the font loading code now uses zlib to read from the files. These fonts in particular were installed with `make install-psf` from the Terminus makefile, however the location may vary from system to system.
2023-01-19Clean up main function a bitcflip
This still had some commented out leftovers from the old event loop, and the default window size has also been adjusted.
2023-01-19Show filename and current working directory in window titlecflip
2023-01-18Add 'const' to the list of syntax wordscflip
2023-01-18Reimplement syntax highlightingcflip
2023-01-18Refactor text rendering codecflip
Previously, the editor would print visible lines plus the statusline and message bar into a buffer, then the window would display this entire buffer. This refactor makes the window directly read lines from the editor and individually display them on the screen. This will make it easier to do syntax highlighting, since that information is stored per line. The statusline and message line are still printed into a buffer to be displayed by the window, but they are now positioned from the bottom of the screen.
2023-01-18Remove the TODO listcflip
I'll probably never remember to keep it up to date anyway.
2023-01-17Fix cursor rendering when view is scrolled horizontallycflip
2023-01-17Allow window to be resizablecflip
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-16Improve behaviour when opening a file from the command linecflip
The editor had two issues when reading a file with a name from the command line. The most annoying issue was that when reallocating the internal filename in the editor, the null terminator wasn't copied which sometimes left garbage at the end of the filename. The other issue was that the editor would quit with a fatal error if there was no file with the specified name, when it should open the file anyway and just create it on save.
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-12Print an error message if loading the font file failscflip
2023-01-12Clean up editor_state's memory on teardowncflip
2023-01-12Replace call to strdup() with equivalent behaviourcflip
This was causing the editor to crash on startup when opening a file from the command line.
2023-01-12Free unicode translation table from font on destructioncflip
This code change and commit message were both written using the text editor!
2023-01-12Big improvements to font renderingcflip
The previous rasterizing code relied on each row in the font being 8 bits wide, which is not the case with any font wider than 8 pixels. These changes make it possible to properly load the 24px Terminus font, and somehow also fixes incorrect characters in the 12px font.
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-12Add an indicator to the status bar when in insert modecflip
2023-01-12Add a cursorcflip
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-11Use the new error function with the new window and font codecflip
2023-01-11Remove all terminal-related codecflip
2023-01-11Get editor size from the window instead of the terminalcflip
Previously the editor would resize itself upon startup by finding the size of the current terminal window, but now that it is running in an actual window it should get the number of rows and columns from there. This also adds parameters for the window size in rows and columns to the window_init() function.
2023-01-11Don't try to draw newline characterscflip
2023-01-10Parse unicode tables in PSF fontscflip
2023-01-10Improve makefilecflip
2023-01-10Use PSF instead of BSF format for fontscflip
This binary file format is much easier to parse.
2023-01-09Implement basic keyboard event handlingcflip
2023-01-08Hook up the editor output to the windowcflip
Now the text editor is visible in the window! There are still escape codes for terminal output all over the place, but this is a good start.
2023-01-08Compile with debug information enabledcflip
2023-01-08Connect the window and font code to the editor's main functioncflip
2023-01-08Create a simple bitmap font reader and renderercflip
There isn't much reason for the editor to run in a terminal window, so the next step is to draw and get input events from a graphical window using SDL. This commit adds a basic test program that can read a font in the BDF format and display text to the screen. This code will eventually be integrated with the rest of the editor.
2023-01-08Use C-style include guards instead of #pragma oncecflip
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/.