Iâm trying to implement configurable key bindings in tt. Boy, is parsing the key names into tcell.EventKeys a horrible thing. This type consists of three information:
- maybe a predefined compound key sequence, like Ctrl+A
- maybe some modifiers, such as Shift, Ctrl, etc.
- maybe a rune if neither modifiers are present nor a predefined compound key exists
Itâs hardcoded usage results in code like this:
func (t *TreeView[T]) InputHandler() func(event *tcell.EventKey, setFocus func(p tview.Primitive)) {
return t.WrapInputHandler(func(event *tcell.EventKey, setFocus func(p tview.Primitive)) {
switch event.Key() {
case tcell.KeyUp:
t.moveUp()
case tcell.KeyDown:
t.moveDown()
case tcell.KeyHome:
t.moveTop()
case tcell.KeyEnd:
t.moveBottom()
case tcell.KeyCtrlE:
t.moveScrollOffsetDown()
case tcell.KeyCtrlY:
t.moveScrollOffsetUp()
case tcell.KeyTab, tcell.KeyBacktab:
if t.finished != nil {
t.finished(event.Key())
}
case tcell.KeyRune:
if event.Modifiers() == tcell.ModNone {
switch event.Rune() {
case 'k':
t.moveUp()
case 'j':
t.moveDown()
case 'g':
t.moveTop()
case 'G':
t.moveBottom()
}
}
}
})
}
This data structure is just awful to handle and especially initialize in my opinion. Some compound tcell.Keys are mapped to human-readable names in tcell.KeyNames. However, these names always use - to join modifiers, e.g. resulting in Ctrl-A, whereas tcell.EventKey.Name() produces +-delimited strings, e.g. Ctrl+A. Gnaarf, why this asymmetry!? O_o
I just checked k9s and theyâre extending tcell.KeyNames with their own tcell.Key definitions like crazy: https://github.com/derailed/k9s/blob/master/internal/ui/key.go Then, they convert an original tcell.EventKey to tcell.Key: https://github.com/derailed/k9s/blob/b53f3091ca2d9ab963913b0d5e59376aea3f3e51/internal/ui/app.go#L287 This must be used when actually handling keyboard input: https://github.com/derailed/k9s/blob/e55083ba271eed6fc4014674890f70c5ed6c70e0/internal/ui/tree.go#L101
This seems to be much nicer to use. However, I fear this will break eventually. And itâs more fragile in general, because itâs rather easy to forget the conversion or one can get confused whether a certain key at hand is now an original tcell.Key coming from the library or an âextendedâ one.
I will see if I can find some other programs that provide configurable tcell key bindings.
@movq@www.uninformativ.de Sorry, I meant the builtin module:
$ python3 -m pep8 file.py
/usr/lib/python3/dist-packages/pep8.py:2123: UserWarning:
pep8 has been renamed to pycodestyle (GitHub issue #466)
Use of the pep8 tool will be removed in a future release.
Please install and use `pycodestyle` instead.
$ pip install pycodestyle
$ pycodestyle ...
I canât seem to remember the name pycodestyle for the life of me. Maybe thatâs why I almost never use it.
Oh no, spam via Jabber is new for me. Fuck them!
rustfmt. I now use similar tools for Python (black and isort).
@movq@www.uninformativ.de @prologic@twtxt.net Thatâs what I like about Go, too. However, every now and then I really dislike the result, e.g. when removing spaces from a column layout. Doesnât happen often, but when it does, I hate it.
I think I should have a look at Python formatters, too. Pep8 is deprecated, I think, itâs been some time that I looked at it.
@movq@www.uninformativ.de Aha! Well, happy hacking. A tiling window manager seems to be good fun. :-)
It drizzled all morning when we picked up the old christmas trees in town with the scouts. Right after lunch the snow storm suddenly hit and dumped three centimeters of snow in just 15 minutes. I cycled home in these crazy conditions, freezing rain hammered my face. As soon as I arrived, it stopped. Itâs now down to drizzling again.
All my soaked gear is now hung up to dry. The next 11 months, Iâm going to find needles over needles in all kind of impossible places.
@movq@www.uninformativ.de Oh, I see. Unfortunately, there seems to be no box drawing character for a corner with a diagonal line. Indeed, this is probably the best you can do.
Is the single character enough to hit it comfortably with the mouse, though? Maybe one additional to the left and above could be something to think about. Not sure. Of course this complicates it a bit more. Personally, I like fullscreen windows, so Iâm definitely the wrong guy to judge this or even comment on. :-)
@movq@www.uninformativ.de Very nice, itâs coming together!
Just in case you havenât already noticed it, the right lower corner of the window in front was not updated when it received the focus. 8-) (In tt I also render focused text input fields with a doubly lined border, where unfocused ones have a single one.)
@bender@twtxt.net Theyâre not completely impossible, but C makes it much easier to run into them. I think the key point is that in those âsafeâ languages, buffer overflows are caught and immediately crash the program (if not handled otherwise) instead of silently corrupting memory, not being noticed right away and maybe only later crashing at a different location, where it can be very hard to find the actual root cause. This is a big improvement in my book.
Some programmers are indeed horrible. Iâm guilty myself. :-)
I like the article.
@movq@www.uninformativ.de Yiha! Even autoscroll, very nice! The naming certainly drew inspiration from Urwid. I like it. Looking forward to eventually checking out its inner workings. :-)
@movq@www.uninformativ.de @prologic@twtxt.net @bender@twtxt.net Given the age, they must mean Kopernikus! https://en.wikipedia.org/wiki/DFS_Kopernikus
@bender@twtxt.net I also went back to my duty today and fixed a problem I created right before vanishing into the holidays. Of course, I discovered more problems while fixing the one thing. Luckily, another public holiday tomorrow. :-)
During my time off, I was a very lazy rat. I planned on doing some woodworking again, but instead I started watching Itchy Bootâs Africa season: https://www.youtube.com/watch?v=pMvfS5mbsiI&list=PL8M9dV_BySaXNvQ_V1q4UU-DirPQlX0ZP
@movq@www.uninformativ.de Cool! :-) I just implemented a workaround for the time being.
@movq@www.uninformativ.de I noticed that your feedâs last modification timestamp was missing in my database. I cannot tell for certain, but I think it did work before. Turns out, your httpd now sends the Last-Modified with UTC instead of GMT. Current example:
Sat, 03 Jan 2026 06:50:20 UTC
Iâm not a fan of this timestamp format at all, but according to the HTTP specification, HTTP-date must always use GMT for a timezone, nothing else: https://httpwg.org/specs/rfc9110.html#http.date
@movq@www.uninformativ.de Letâs hope they find the guys who fired that rocket onto the balcony and we actually get a fireworks ban.
@prologic@twtxt.net Very impressive! :-)
@movq@www.uninformativ.de Very nice! We also had some snow this morning, but itâs already melted. And the sun is missing, too. :-D
@movq@www.uninformativ.de Wow, thatâs sick! :-)
@movq@www.uninformativ.de Iâm pretty sure I know a bunch of people who love to blow up their money. :-(
Holy shit! :-O At least, the walls didnât shake here. But we also had some very loud explosions, maybe they were far enough away. :-? Of course, the bangs continued last night.
Maybe some politicians need to be personally attacked with this sort of shit first in order to ban it once and forever.
@shinyoukai@neko.laidback.moe @prologic@twtxt.net Yeah, itâs been ages that I came across Trac. :-D
The only good thing about this absolute craziness is that I can restock my rocket sticks. I picked up twelve along the way. Unfortunately, it looks like 99.999% of ammunition is bombs instead of rockets. Some sections of my street look exactly like an arbitrary Pakistanian town that Iâve seen online.
There was surprisingly much snow in the woods. Also, all ponds have frozen over. I didnât expect that. Not at all. There were even illegal ice skating tracks in the natural reserve. We came across a large puddle and it was at least 10cm solid ice to the ground. Crazy!
fib(35) doesn't regress too badly as I continue to evolve the language.
@prologic@twtxt.net Not bad for a start, ey! Looking forward to see you going down these rabbit holes and opening one can of worms after the other. :â-D Very, very impressive, hats off to you. :-)
@prologic@twtxt.net Can you just make them optional? :-) But that of course complicates things.
println("Hello World"):
@prologic@twtxt.net Thatâs impressive. How large are the resulting binaries? You donât have any optimizations in place yet, do you?
@movq@www.uninformativ.de I hid in the workshop with earmuffs for the absolute worst part.
@javivf@adn.org.es Heck yeah, letâs do this! :-) Welcome to 2026.
@shinyoukai@neko.laidback.moe We finally abandoned our GitLab. I publicly mirrored my code in the Mills Data Center a few days ago: https://git.mills.io/lyse/tt2
@movq@www.uninformativ.de Well, just a very limited subset thereof:
- inline and multiline code blocks using single/double/triple backticks (but no code blocks with just indentation)
- markdown links using using
[text](url)
- markdown media links using

And thatâs it. No bold, italics, lists, quotes, headlines, etc.
Just like mentions, plain URLs, markdown links and markdown media URLs are highlighted and available in the URLs View. Theyâre also colored differently, similarly to code segments.
I definitely should write some documentation and provide screenshots.
It totally sounds like an active warzone around here. So, I just went on a very, very, very quick stroll to check out our sunset from ontop our hill (were all the bangs are way more horrible): https://lyse.isobeef.org/abendhimmel-2025-12-31/
Hurray, I finally fixed another rendering bug in tt that was bugging me for a long time. Previously, when there were empty lines in a markdown multiline code block, the background color of the code block had not been used for the empty lines. So, this then looked as if there were actually several code blocks instead of a single one.
https://lyse.isobeef.org/tmp/tt-bugfix-empty-lines-in-multiline-code-blocks.png
@movq@www.uninformativ.de Because theyâre just boxes. :-D
@movq@www.uninformativ.de Yeah, I see. Just crudely checked on my computer, with around 0.013 seconds, Python 2.7 seems a tad faster than Python 3.14âs 0.023 seconds in this little program.
The lazy imports sound not too bad, but I just skimmed over them. There are surprisingly many exceptions, but yeah, no way around them. :-)
@movq@www.uninformativ.de Thatâs cool! I also like the name of your library. :-) I assume you made the thing load quickly, didnât you?
I just fixed another bug in tt where the language hint in multiline markdown code blocks had not been stripped before rendering. It just looked like it was part of the actual code, which was ugly. I now throw it away. Actually, itâs already extracted into the data model for possible future syntax highlighting.
Phew, it was just a one-time thing. Ta! :-)
Btw, @shinyoukai@neko.laidback.moe, thatâs a super cool logo on your yarnd. I like it a lot!
It just doesnât look aligned properly: https://lyse.isobeef.org/tmp/misalignment.png Could be a yarnd issue, though, it might not expect a logo this large. Just wildguessing, no idea.
git add everything!? Is it not enough for the file(s) to be already checked in from the get go?
@shinyoukai@neko.laidback.moe Because you might not want to commit all changed files in a single commit. I very often make use of this and create several commits. In fact, I like to git add --patch to interactively select which parts of a file go in the next commit. This happens most likely when refactoring during a feature implementation or bug fix. I couldnât live without that anymore. :-)
If you have a much more organized way of working where this does not come up, you can just git commit --all to include all changed files in the next commit without git adding them first. But new files still have to be git added manually once.
@shinyoukai@neko.laidback.moe Do we now need ad filters in twtxt clients, too? O_o I hope not! Personally, I cannot stand the âSent with my crappy $phone/$appâ e-mail footers.
But congrats on your client. :-)
os.UserConfigDir() up until a few seconds ago! I always implemented that myself.
@shinyoukai@neko.laidback.moe Yeah, they donât truly support XDG. In fact, I looked in the Go stdlib source code to notice all the differences and shortcomings.
$HOME is not specified it tries to resolve the user's home directory by user.Current().HomeDir. Maybe that's overkill, I have to check the XDG spec.
Ok, the standard library implementation is wonky at best, at least in regards to XDG, because it really doesnât implement it properly. https://github.com/golang/go/issues/62382 I stick to my own code then. It doesnât properly support anything else than Linux or Unixes that use XDG, but personally, I donât care about them anyway. And the cross-platform situation is a giant mess. Unsurprisingly.
os.UserConfigDir() up until a few seconds ago! I always implemented that myself.
Hmm, mine also resolves a leading tilde in these variables. And if $HOME is not specified it tries to resolve the userâs home directory by user.Current().HomeDir. Maybe thatâs overkill, I have to check the XDG spec.
But Iâm definitely missing os.UserDataDir(). Thatâs a bummer.
@shinyoukai@neko.laidback.moe Cool, I didnât know about os.UserConfigDir() up until a few seconds ago! I always implemented that myself.
@movq@www.uninformativ.de Thanks! Iâll have a look at SnipMate. Currently, Iâm (mis)using the abbreviation mechanism to expand a code snippet inplace, e.g.
autocmd FileType go inoreab <buffer> testfunc func Test(t *testing.T) {<CR>}<ESC>k0wwi
or this monstrosity:
autocmd FileType go inoreab <buffer> tabletest for _, tt := range []struct {<CR> name string<CR><CR><BS>}{<CR> {<CR> name: "",<CR><BS>},<CR><BS>} {<CR> t.Run(tt.name, func(t *testing.T) {<CR><CR>})<CR><BS>}<ESC>9ki<TAB>
But this of course has the disadvantage that I still have to remove the last space or tab to trigger the expansion by hand again. Itâs a bit annoying, but better than typing it out by hand.
Oh, suddenly Mother Hulda dumped a centimeter of snow tonight! https://lyse.isobeef.org/schnee-2025-12-30/01.jpg
Magpie from the day before yesterday: https://lyse.isobeef.org/elster-2025-12-28/
Question to my fellow Vimers: Which snippet insertion mechanism are you using or can you (not) recommend?
Pro tip: Donât keep the christmas biscuits close to the bird fat balls. I nearly mixed up the bags. :-D
@movq@www.uninformativ.de Yeah. I had that in my Python implementation and was really missing that.
@movq@www.uninformativ.de I see. Yeah, all the Unicode stuff certainly doesnât help here, thatâs for sure.
Maybe âspeedcursesâ could be a name. Or just select any Palatinate curse. ;-)