foreseen

A text-based gemini browser with prefetching
git clone git://git.laack.co/foreseen.git
Log | Files | Refs | README | LICENSE

render.hpp (977B)


      1 #include <ncurses.h>
      2 #include <unctrl.h>
      3 
      4 #include <cassert>
      5 #include <cstdint>
      6 #include <string>
      7 #include <utility>
      8 #include <vector>
      9 
     10 #include "../include/browser.hpp"
     11 #include "../include/utils.hpp"
     12 
     13 #pragma once
     14 
     15 struct DrawState {
     16     std::vector<std::pair<std::string, TextRender>> prior;
     17     std::vector<std::pair<std::string, TextRender>> broken;
     18     bool mustReRender = true;
     19     Browser* bPtr;
     20     std::string header;
     21     int y;
     22     bool handleInput;
     23     bool handleOpenOther;
     24     bool handleRedirect;
     25     bool reBreak = true;
     26     std::string issueText;
     27     uint64_t timeToClearIssueText;
     28     uint64_t timeToClearBottomText;
     29     std::string bottomText;
     30     std::string redirInput;
     31     std::string openOtherInput;
     32     std::string userInput;
     33     std::string metaLine;
     34     bool toLowest = false;
     35     int columns;
     36     int lines;
     37 };
     38 
     39 bool mainLoop(DrawState& ds, Browser& b, int input, int cols, int lines);
     40 void tryVisitSite(DrawState& ds, Browser& b, std::string site);