|
|
|
@ -7,11 +7,26 @@
|
|
|
|
|
|
|
|
|
|
using namespace ncpp;
|
|
|
|
|
|
|
|
|
|
auto main() -> int {
|
|
|
|
|
auto usage(const char* argv0, int ret) -> void {
|
|
|
|
|
std::cerr << "usage: " << argv0 << " [ -hs ]" << std::endl;
|
|
|
|
|
exit(ret);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
auto main(int argc, const char** argv) -> int {
|
|
|
|
|
if(!setlocale(LC_ALL, "")){
|
|
|
|
|
std::cout << "Error setting locale\n";
|
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
|
}
|
|
|
|
|
bool horscroll = false;
|
|
|
|
|
if(argc == 2){
|
|
|
|
|
if(strcmp(argv[1], "-hs") == 0){
|
|
|
|
|
horscroll = true;
|
|
|
|
|
}else{
|
|
|
|
|
usage(argv[0], EXIT_FAILURE);
|
|
|
|
|
}
|
|
|
|
|
}else if(argc > 2){
|
|
|
|
|
usage(argv[0], EXIT_FAILURE);
|
|
|
|
|
}
|
|
|
|
|
notcurses_options nopts{};
|
|
|
|
|
nopts.flags = NCOPTION_INHIBIT_SETLOCALE;
|
|
|
|
|
NotCurses nc(nopts);
|
|
|
|
@ -22,6 +37,7 @@ auto main() -> int {
|
|
|
|
|
opts.physrows = dimy / 8;
|
|
|
|
|
opts.physcols = dimx / 2;
|
|
|
|
|
opts.egc = "░";
|
|
|
|
|
opts.flags = horscroll ? NCREADER_OPTION_HORSCROLL : 0;
|
|
|
|
|
// FIXME c++ is crashing
|
|
|
|
|
//Reader nr(nc, 0, 0, &opts);
|
|
|
|
|
auto nr = ncreader_create(**n, 2, 2, &opts);
|
|
|
|
@ -38,8 +54,18 @@ auto main() -> int {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
int y, x;
|
|
|
|
|
ncplane_cursor_yx(ncreader_plane(nr), &y, &x);
|
|
|
|
|
nc.cursor_enable(y + 2, x + 2);
|
|
|
|
|
struct ncplane* ncp = ncreader_plane(nr);
|
|
|
|
|
ncplane_cursor_yx(ncp, &y, &x);
|
|
|
|
|
nc.cursor_enable(y + 2, 2 + (x >= ncplane_dim_x(ncp) ? ncplane_dim_x(ncp) - 1 : x));
|
|
|
|
|
int ncpy, ncpx;
|
|
|
|
|
ncplane_cursor_yx(ncp, &ncpy, &ncpx);
|
|
|
|
|
struct ncplane* tplane = ncplane_above(ncp);
|
|
|
|
|
int tgeomy, tgeomx, vgeomy, vgeomx;
|
|
|
|
|
ncplane_dim_yx(tplane, &tgeomy, &tgeomx);
|
|
|
|
|
ncplane_dim_yx(ncp, &vgeomy, &vgeomx);
|
|
|
|
|
(*n)->printf(0, 0, "Scroll: %lc Cursor: %d/%d Viewgeom: %d/%d Textgeom: %d/%d",
|
|
|
|
|
horscroll ? L'✔' : L'🗴',
|
|
|
|
|
ncpy, ncpx, vgeomy, vgeomx, tgeomy, tgeomx);
|
|
|
|
|
nc.render();
|
|
|
|
|
}
|
|
|
|
|
nc.render();
|
|
|
|
|