Commit Graph

442 Commits

Author SHA1 Message Date
Kartik K. Agaram
8807168729 grey rather than harsh white background 2021-12-04 20:54:01 -08:00
Kartik K. Agaram
0429cfca74 clearer usage message 2021-12-04 20:38:49 -08:00
Kartik K. Agaram
d9cf3433d9 start showing call stack on errors
It turns out Lua has been providing us this information all along! I'd
just not created the space on screen to show it. Make it persist better.

Kilo now no longer tracks its own status messages, which is a regression
in a rare condition.
2021-12-04 14:12:36 -08:00
Kartik K. Agaram
810e160136 another fix for colors
I'd assumed that assume_default_colors updates fg/bg -1, but it doesn't.
Looks like I can't ever use -1 colors.
2021-12-03 23:12:02 -08:00
Kartik K. Agaram
294c135d3f elaborate a little more on install instructions
Thanks to Mariano Guerra for the Nix command, and to Konrad Hinsen for
the Guix command.
2021-12-03 20:55:32 -08:00
Kartik K. Agaram
267489c19f support the comment/uncomment hotkey on Macs
^/ works on Linux but not on Mac
^- emits the same character code on Mac
^_ seems to be the underlying character code, and works on both
ctrl-7 also emits the same character code
2021-12-03 20:19:32 -08:00
Kartik K. Agaram
950957619c less ambiguous menus
Doesn't make sense to use '/' as a delimiter when we have hotkeys
involving '/'.
2021-12-03 20:13:52 -08:00
Kartik K. Agaram
bbab1a7c10 get rid of Esc hotkey
For a variety of historical reasons, terminals pause every time you
press `Esc`. Let's get rid of that lag.
2021-12-03 19:45:51 -08:00
Kartik K. Agaram
fe5f542991 typos 2021-12-03 19:11:52 -08:00
Kartik K. Agaram
138282549e experimenting with different keys
On a Thinkpad X13, the `delete` key emits `^[[3~` outside of Teliva.
Within Teliva, ncurses converts it to character code 330 (0x14a), which
it fails to recognize as KEY_BACKSPACE. Why?

My backspace is converted to character code 263, which ncurses does
recognize as KEY_BACKSPACE.

ctrl-h is character code 8.

Both 330 and 263 are valid Unicode code points, which feels really ugly
and ambiguous.
2021-12-03 18:38:17 -08:00
Kartik K. Agaram
d3a12fb7f1 stop showing frequent save messages 2021-12-03 18:30:24 -08:00
Kartik K. Agaram
a796070c9b show ^h in a couple more menus 2021-12-03 18:23:40 -08:00
Kartik K. Agaram
31af4bd1fd improve support for backspace
I still don't understand the entire state space here, so I'm trying to
err on the side of improving discoverability of the `ctrl-h` escape
hatch. Without requiring too wide a window to show all hotkeys on the
menu.
2021-12-03 18:05:25 -08:00
Kartik K. Agaram
4c196576aa error message when no app is provided
Also strip out a bunch of Lua's commandline parsing.
2021-12-03 17:34:21 -08:00
Kartik K. Agaram
8ea7a3bde5 . 2021-12-03 17:23:37 -08:00
Kartik K. Agaram
516ac2fa8e describe the manual process to obtain a dark bg
https://github.com/akkartik/teliva/issues/1
2021-12-03 17:19:40 -08:00
Kartik K. Agaram
947abf2ba3 legible colors across all terminal configurations
So far I've been trying to make Teliva follow the default colorscheme of
the terminal, but that easily ends up with illegible color combinations.
New plan: always start with a light background within Teliva. People who
want a dark background will currently need to mess with C sources.

This should somewhat fix https://github.com/akkartik/teliva/issues/1.
It's still not clear whether the default should be a dark or light
background. While dark background is more common in terminals, I believe
newcomers to terminals will prefer a light background. Then again, I'm
biased since I use a light background in my terminals.
2021-12-03 16:59:25 -08:00
Kartik K. Agaram
6f6595b39a show state of screen on runtime error
This is essential when debugging.
2021-12-03 16:12:51 -08:00
Kartik K. Agaram
c7dea9f5a3 . 2021-12-03 16:00:59 -08:00
Kartik K. Agaram
87443b9815 extract a helper 2021-12-03 15:54:35 -08:00
Kartik K. Agaram
148fe6dfbd more speculatively efficient advent.tlv 2021-12-02 20:40:51 -08:00
Kartik K. Agaram
3f930ed73e fix a slight portability issue, maybe
When installing using NixOS[1], the screen looks wrong. It looks like
attrset(A_NORMAL) does not undo color changes with some versions of
dependencies.

[1] https://github.com/marianoguerra/marianoguerra.github.io/blob/master/advent-of-future-of-code/days/day-02.md
2021-12-02 01:49:57 -08:00
Kartik K. Agaram
e001212e99 stop inserting ctrl- keys into programs 2021-11-30 17:44:01 -08:00
Kartik K. Agaram
cbe7d1bf40 fix advent.tlv
Thanks sejo.
2021-11-30 17:16:15 -08:00
Kartik K. Agaram
51ba37665c some little shortcuts for Advent of Code
https://archive.org/details/akkartik-teliva-2021-11-30
2021-11-30 15:02:09 -08:00
Kartik K. Agaram
f5a6f434c5 better cross-platform backspace support
I wish I could just hide KEY_BACKSPACE and prevent myself from using it
by accident.

Then again, I'm not making this smarts available in Teliva programs
themselves. Just for the Teliva environment.
2021-11-30 09:56:06 -08:00
Kartik K. Agaram
ce3ad17a05 kilo bugfix: syntax highlight final word in line
Kilo likely never ran into this because it's only been tested on C,
which uses semi-colons at the end of each statement.
2021-11-29 22:49:47 -08:00
Kartik K. Agaram
85e06b7b0f gotcha: silent string concatenation 2021-11-29 22:49:45 -08:00
Kartik K. Agaram
61accc5b8e . 2021-11-29 22:48:14 -08:00
Kartik K. Agaram
d7a1792768 a couple more global curses bindings 2021-11-29 22:40:42 -08:00
Kartik K. Agaram
b6bca6ac14 fix regression in showing error messages 2021-11-29 22:38:46 -08:00
Kartik K. Agaram
fa52f129fb . 2021-11-29 22:06:54 -08:00
Kartik K. Agaram
cc757ffc4c why not keep manual tests in the repo? 2021-11-29 08:18:28 -08:00
Kartik K. Agaram
36d3d10b1a let people fix bad images from within Teliva
Short of syntax errors that keep us from parsing the teliva_program
table, we should now be able to recover gracefully from everything.

Yesterday I started to try to add this to load_definitions before
realizing most errors are only noticed while running `main`. But I
didn't think of recovering from the docall of `main` until this morning.
2021-11-29 08:16:47 -08:00
Kartik K. Agaram
c9de6ae5d6 redo uncomment
It was printing a phantom null at end of line on screen.
2021-11-28 21:48:38 -08:00
Kartik K. Agaram
418fce4464 auto-indent 2021-11-28 21:21:17 -08:00
Kartik K. Agaram
3203bf7aff tab key: always insert two spaces 2021-11-28 21:16:50 -08:00
Kartik K. Agaram
f6c2974cb4 hide some 'advanced' hotkeys to support narrow windows 2021-11-28 21:09:29 -08:00
Kartik K. Agaram
e80af9206c ctrl-/ to comment/uncomment line 2021-11-28 21:08:12 -08:00
Kartik K. Agaram
eec4845c31 ctrl-u/ctrl-k to make editing a bit more ergonomic 2021-11-28 20:48:54 -08:00
Kartik K. Agaram
68211363ca special indent settings for kilo 2021-11-28 20:41:55 -08:00
Kartik K. Agaram
316e309928 indent 2021-11-28 20:41:55 -08:00
Kartik K. Agaram
b24a47dd0d mac backspace attempt 3 2021-11-28 16:27:02 -08:00
Kartik K. Agaram
af4e2e0751 fix half-assed mac os backspace commit 2021-11-28 16:19:01 -08:00
Kartik K. Agaram
383832b58b sacrificing another LoC to ward off crashes
It makes me very nervous now that there's save_editor_state within
editor event loop, when the editor could be editing notes. Things are
slightly better than this morning, but this prototype still suxxors.
2021-11-28 15:55:01 -08:00
Kartik K. Agaram
2ea9462ed1 editing notes sucks a little less
I think I've gotten rid of all the segfaults, but it's still pretty
messed up: if you hit ctrl-g and go edit some definition, it doesn't get
saved. You're just storing the edit in the note.
2021-11-28 15:45:28 -08:00
Kartik K. Agaram
2f42187663 fix the bug described in commit cec57992b7 2021-11-28 15:19:26 -08:00
Kartik K. Agaram
37068ef8d2 rename a fn and reorganize its responsibilities 2021-11-28 15:14:00 -08:00
Kartik K. Agaram
908b2634c6 split a lumpy abstraction into two cleaner ones
I'm mindful of the way abstractions can create duplicate effort:
  https://flak.tedunangst.com/post/browser-ktrace-browsing

== Kartik's SAD theorem
As programs grow complex, you will be repeatedly forced to either:
  - maintain some State,
  - perform some computations Again,
  - or Duplicate some code.

Here a small amount of duplication seems like the best alternative.
Particularly since no syscalls are involved.
2021-11-28 15:03:10 -08:00
Kartik K. Agaram
aed8da7750 purge abstraction hiding teliva_editor_buffer 2021-11-28 14:51:35 -08:00