I didn't touch ptts for some time now, mostly because I really didn't felt like messing with the instructions and pages again. Still recovering from the last part. I do still want ptts to be project I finish one day however, (this b-log is good motivation) so I decided to start working on some other part. Since there isn't that many parts and I don't feel like learning pdf right now, I decided to try the TUI.
So first, why not just pipe it into less? Well, I have plans for footnotes that will require my own interface. I also decided to not use ncurses, but make my own TUI with ANSI escape sequences. I don't know how well would ncurses work with escape sequences in text and it feels like a bit of a overkill for my needs. Rolling my own sounds like more fun anyways. I did use term reader to read input tho, so I guess no longer dependency-free.
currently can scroll as far under text as you want, but I kinda like that. At least you can keep yor text centered even at the end and if you manage to scroll a bit too far, end will still bring you right at the end.
unless STDOUT.tty? Data.output_mode = :stdout end
So you know how when you close vim or man or mc or whatever, it just returnsr back to your terminal as if nothing happened? It does actually opens alternative terminal buffer (also didn't know terminals have this) and works here until closed. It's all done using escape sequences. This is also possibly why it vim does not do this in tty. (mc still does tho...)
# open new buffer (and go to top left corner) print "\x1b[?1049h\x1b[H" # go back to original buffer print "\x1b[?1049l"
Searches are done in regex and can't span accross multiple lines. Your search always starts from beginning of file and they loop. I prefer this over normal search in less. you also don't see the results highlighted since I was lazy, but your cursor moves to the current word. I must once again express my appriciation for having regex built right into the language and not just as some (possibly third party) library. I still think globals and for loops would be nice tho.
Guess I'll have to do instructions next anyways so that's a thing...