Commit Briefs

Omar Polo

persist list of visited URLs to the disk

Persist a generalized history of visited URL in history_file and try to keep it in sync during telescope usage and shutdown.


Omar Polo

const-ify some tables


Omar Polo

remote open: open an url into telescope from outside of it

if telescope is started with an url while there is already another instance of it running and the -S flag is not provided, the link will be automagically opened into the running instance of telescope. Telescope now listens on a UNIX domain socket in ~/.telescope/ctl (or ~/.cache/telescope/ctl if XDG is used) for commands.



Omar Polo

reply-last-input: reply input requests on demand

Telescope now remebers the last URL (per tab!) that replied with 1X (input request.) The new command reply-last-input allows to resend a query to that URL. It's particularly useful with capsules that make a heavy uses of 10 replies (search engines or similar, interactive pages, etc) because it both saves a network roundtrip and the user from looking for the "search" link all across the page ;-) idea from a conversation with thfr@, thanks!



Omar Polo

move load_page_from_str to telescope.c

I'd like to use parser{,_gophermap,_gemtext}.c in standalone testing programs, and this function is getting in the way since it depends on ui.c


Omar Polo

correctly save scrolling position

Before we didn't save the scrolling position before a refresh (nohist=1) and that's annoying. This saves the scrolling position only in the correct case, which is when changing from a page to another, expect when switching to TAB_LAZY off.


Omar Polo

move TAB_LAZY flipping from switch_to_tab in load_url

load_url needs to know when a tab passes from lazy to not lazy to correctly saves the scrolling position (see follow-up commit.)


Omar Polo

save and restore scroll position

Save the offset to the first and current line of the buffers and restore it when the page is loaded. This restores almost the exact viewport: we save the offset of the *real* line in the document, but they get wrapped before being displayed, so the actual restored position may be slightly above from the original one (think of a long paragraph that gets wrapped over multiple visual lines.) In practice, this isn't a drawback but only an improvement over the current behaviour. In the future we could save also the offset *inside* the line, to restore the exact position, but that felt unnecessary for now. Persisting the postion on the session file ensures that even when re-opening telescope the scroll position is correct. There are some very active pages, such as antenna or other aggregator, where this feature doesn't really work well if you re-open the page after a while, since new links are available, but otherwise is a god sent! See also github issue #1


Omar Polo

avoid possible use after free

`url' may be a pointer to a string of the buffer which gets corrupted upon tab_stop. This bug shows when loadfn is load_about_url, because in make_fs_request we first tab_stop, and then send the request, which ends up sending to the fs process a free'd string. At least on OpenBSD with Otto' malloc is (partially) corrupted and will either make the fs process abort or return a not found page. One solution may be to rework make_fs_request to process things in a different order, but that would only hide the problem. Instead, use the newly created history element as url given to the loadfns: that is guaranteed to be valid up to the next load_url call. Reported by Brian Callahan, thanks!


Omar Polo

simplify load_url_in_tab


Omar Polo

move util.c declarations in utils.h

it's not spelled `util.h' because otherwise it'd get included instead of /usr/include/util.h


Omar Polo

simplify the caching API

- don't expose the evbuffer where we store the cached page - cache to/from tabs instead of buffers


Omar Polo

fix start_loading_animation usage

the idiom if (load_next_page(...)) start_loading_anim(...); is fundamentally wrong because `load_next_page' (or previous page, or anything else that call into load_url) *may* load all the page before returning (thanks to the cache, but not only, cf. load_page_from_str.) Instead, let's call start_loadign_anim at the start of make_request so it's always called in the right moment. Cache and other special pages don't end up calling make_request anyway, and we already call stop_loading_anim when a request finishes (or fails.) move start_loading_anim up in make_request.