refactor: change syntax highlight colors
- Change digit character color to foreground light red.
- Change color of the matched substring on searching to foreground light
blue.
- Change color of anything else that might slip through
`syntax_to_color()` to default foreground color.
- Add `:` to the list of separator character.
refactor: improve number highlighting
Highlight numbers only when they are preceded by a separator character,
which includes whitespace, punctuation characters or NUL.
References: https://todo.sr.ht/~cezelot/eve/1
feat: highlight search results
style: shorten my name in copyright notices
docs: update CHANGELOG.md
refactor: merge the non-printable key
- Merge the non-printing key actions in `handle_special_keys` function.
- Add `quit_times` to `t_env` so that it is possible to handle `CTRL_Q`
with the rest of signals.
Signed-off-by: Alberto Rodriguez <alrodriguezgar14@gmail.com>
Reviewed-by: Ismaël Benjara <ib@cezelot.me>
style: check calls to `malloc()` and `realloc()`
Check every call to `malloc()` and `realloc()` to see if it returned
`NULL`.
style: change tab size to 8
style: update coding style
- Indent with 8-column tabs. 8 column tabs are the default, and will
render consistently in any editor, terminal, web browsers, and other
places where the code may appear.
- Use braces where the language makes them optional.
Single-line if statements, loops, etc, must use braces. It's a small
loss for ergonomics with a tangible benefit for error prevention.
- Place opening braces on the same line (excluding function definitions).
- Start the name of the function in column one for function definitions.
This helps people to search for function, i.e.,
`git grep '^my_function'`, and may also help certain tools recognize
them.
- Double-indent continuation lines for new scopes.
- Single-indent continuation lines in the same scope.
- Split long string literals into multiple lines. When long strings hit
80 columns, terminate the string and resume it on the following line.
- Declare typedefs, structs and enums with the `{` on the first line.
docs: update CHANGELOG.md
refactor(file): refactor the `save()` logic
- Use the early return pattern to reduce the bumpy road and too much
right indentation.
- Create helper functions to move outside of save the success or fail
checks and the cleanup; free buffer and close fd.
refactor: improve special keys handling logic
Completely redone the logic for handling special keys. Built an array of
structs containing a pair of key_value-function_pointer. The array is
sorted and accessed in O(log n). If the key is missing, return 0.
If the key handler has been accessed, return 1.
Previously, the logic was based on if/else and switch/case statements,
which added too much complexity.
docs: update contact information in README.md