lyse

lyse.isobeef.org

No description provided.

Recent twts from lyse

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:

  1. maybe a predefined compound key sequence, like Ctrl+A
  2. maybe some modifiers, such as Shift, Ctrl, etc.
  3. 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.

⤋ Read More
In-reply-to » @lyse

@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.

⤋ Read More
In-reply-to » Since I used so much Rust during the holidays, I got totally used to 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.

⤋ Read More

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.

⤋ Read More
In-reply-to » @lyse Ah, the lower right corner is different on purpose: It’s where you can click and drag to resize the window. https://movq.de/v/cbfc575ca6/vid-1767977198.mp4 Not sure how to make this easier to recognize. 🤔 (It’s the only corner where you can drag, btw.)

@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. :-)

⤋ Read More
In-reply-to » I think my widget toolkit will have an amber theme by default:

@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.)

⤋ Read More
In-reply-to » I came across this on "Why Is SQLite Coded In C", which I found interesting:

@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.

⤋ Read More
In-reply-to » Ending three luxurious do-what-I-please weeks; tomorrow is back to work. What do you all do during your break (and this assumes you had one, even if short)? I mostly did nothing, which in itself was truly something! So much, I long to do it all over again. A man can dream, right? Haha!

@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

⤋ Read More

@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

⤋ Read More
In-reply-to » @lyse I haven’t spoken to a single person yet who was a fan of all this. Not even the more conservative family members.

@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.

⤋ Read More

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!

https://lyse.isobeef.org/waldspaziergang-2026-01-01/

⤋ Read More
In-reply-to » @lyse A "Hello World" binary is ~372KB in size. I currently have peephole optimization and deac code optimizations in play, and a few other performance related ones, but nothing too fancy. I have a test case that ensures 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. :-)

⤋ Read More
In-reply-to » @lyse You actually have a Markdown parser/renderer in there? Oh dear. I would have been (well, I am) way too lazy for that. 😅

@movq@www.uninformativ.de Well, just a very limited subset thereof:

  1. inline and multiline code blocks using single/double/triple backticks (but no code blocks with just indentation)
  2. markdown links using using [text](url)
  3. markdown media links using ![alt](url)

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.

⤋ Read More
In-reply-to » @movq That's cool! I also like the name of your library. :-) I assume you made the thing load quickly, didn't you?

@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. :-)

⤋ Read More