Commits


set_scroll_position: always set current_line There's a small chance we may end up finding the topline but not the current line if a page content is abruptedly changed. While here also drop `curfound = 1': it's a dead assignment since it returns in that conditions. Bug found while reading the output of clang' scan-build, but not thanks to clang. scan-build complained about the `curfound' variable, and by re-reading the code I spotted the missing case.


gemini_parse_reply: return code and don't close connection clang static analyzer found a possible use after free: if the code is not 2X in gemini_parse_reply we call close_conn. Then, in net_read we set req->done_header, but req may have been free'd! Actually, this is almost impossible to trigger. close_conn never ends up calling free(req) on its first try, because tls_close takes a while and is rescheduled by libevent. (The check req->ctx != NULL in close_conn is always true if it's a gemini request.) Nevertheless, it's clear to move close_conn out of gemini_parse_reply and simply return the response code: it feels wrong that a "parsing function" takes logic decisions.


declare data as uint8_t *; pointer arith on void * is a GNU extension


add some more warnings to the mix


fix tests for build out-of-tree now `make distcheck' works as advertised


add test of parsing and deserialization of gophermaps


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


switch the cache to the new parser_serialize API


parsers: add serialize function Add a parser_serialize function and an optional function `serialize' for parsers. The default implementation just prints the text line, which is suitable for parser_textplain and parser_textpatch; gemtext and gophermap uses their own specific unparse functions. This is intended for an incoming cache refactoring: we'll cache the page serialized in the correct format, not once it has been translated to gemtext. This will allow in the future to provide commands such as ``save page to disk'' or interface with an on-disk cache.


add fn pointer to the parser init function to struct parser will come in handy in the future cache refactoring.


use parser_init instead of directly calling the parser init fn


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.


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


typo in parse_session_line without +4 strtonum sees top=X and cur=Y which are invalid numbers, so the scroll position is lost.


sync changelog