examples/dom/paragraph.cpp

    //Copyright2020ArthurSonzogni.Allrightsreserved.
    //UseofthissourcecodeisgovernedbytheMITlicensethatcanbefoundin
    //theLICENSEfile.
    #include<chrono>//foroperator""s,chrono_literals
    #include<ftxui/screen/screen.hpp>//forFull,Screen
    #include<iostream>//forcout,ostream
    #include<memory>//forallocator,shared_ptr
    #include<string>//forstring,operator<<
    #include<thread>//forsleep_for

    #include"ftxui/dom/elements.hpp"//forhflow,paragraph,separator,hbox,vbox,filler,operator|,border,Element
    #include"ftxui/dom/node.hpp"//forRender
    #include"ftxui/screen/box.hpp"//forftxui

    usingnamespacestd::chrono_literals;
    intmain(){
    usingnamespaceftxui;
    std::stringp=
    R"(Inprobabilitytheoryandstatistics,Bayes'theorem(alternativelyBayes'laworBayes'rule)describestheprobabilityofanevent,basedonpriorknowledgeofconditionsthatmightberelatedtotheevent.Forexample,ifcancerisrelatedtoage,then,usingBayes'theorem,aperson'sagecanbeusedtomoreaccuratelyassesstheprobabilitythattheyhavecancer,comparedtotheassessmentoftheprobabilityofcancermadewithoutknowledgeoftheperson'sage.OneofthemanyapplicationsofBayes'theoremisBayesianinference,aparticularapproachtostatisticalinference.Whenapplied,theprobabilitiesinvolvedinBayes'theoremmayhavedifferentprobabilityinterpretations.WiththeBayesianprobabilityinterpretationthetheoremexpresseshowasubjectivedegreeofbeliefshouldrationallychangetoaccountforavailabilityofrelatedevidence.BayesianinferenceisfundamentaltoBayesianstatistics.)";

    std::stringreset_position;
    while(true){
    autodocument=vbox({
    hflow(paragraph(p)),
    separator(),
    hflow(paragraph(p)),
    separator(),
    hbox({
    hflow(paragraph(p)),
    separator(),
    hflow(paragraph(p)),
    }),
    })|
    border;

    document=vbox(filler(),document);

    //autoscreen=Screen::Create(Dimension::Fit(document));
    //Render(screen,document);
    //screen.Print();
    //getchar();

    autoscreen=Screen::Create(Dimension::Full());
    Render(screen,document);
    std::cout<<reset_position;
    screen.Print();
    reset_position=screen.ResetPosition();

    std::this_thread::sleep_for(0.01s);
    }

    return0;
    }