diff --git a/.drone.yml b/.drone.yml index 993f66909..a9b2840ef 100644 --- a/.drone.yml +++ b/.drone.yml @@ -11,7 +11,7 @@ steps: - export TERM=xterm - mkdir build - cd build - - cmake .. -DCMAKE_BUILD_TYPE=Release -DUSE_GPM=on -DUSE_QRCODEGEN=on -DDFSG_BUILD=on + - cmake .. -DCMAKE_BUILD_TYPE=Release -DUSE_STATIC=off -DUSE_GPM=on -DUSE_QRCODEGEN=on -DDFSG_BUILD=on - make -j2 - ./notcurses-info - ctest --output-on-failure diff --git a/CMakeLists.txt b/CMakeLists.txt index 4b2c1c712..46666a096 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -637,15 +637,15 @@ target_link_libraries(nctetris endif() ############################################################################ -# ncman +# tfman if(NOT WIN32) -file(GLOB NCMANSRCS CONFIGURE_DEPENDS src/man/*.c) -add_executable(ncman ${NCMANSRCS} ${COMPATSRC}) -target_compile_definitions(ncman +file(GLOB tfmanSRCS CONFIGURE_DEPENDS src/man/*.c) +add_executable(tfman ${tfmanSRCS} ${COMPATSRC}) +target_compile_definitions(tfman PRIVATE _GNU_SOURCE ) -target_include_directories(ncman +target_include_directories(tfman BEFORE PRIVATE include @@ -655,7 +655,7 @@ target_include_directories(ncman "${libdeflate_INCLUDE_DIRS}" "${ZLIB_INCLUDE_DIRS}" ) -target_link_libraries(ncman +target_link_libraries(tfman PRIVATE notcurses-core "${libdeflate}" @@ -988,7 +988,7 @@ install(TARGETS notcurses-demo DESTINATION bin) install(TARGETS notcurses-info DESTINATION bin) install(TARGETS ncneofetch DESTINATION bin) if(NOT WIN32) -install(TARGETS ncman DESTINATION bin) +install(TARGETS tfman DESTINATION bin) endif() if(${USE_CXX}) install(TARGETS notcurses-input DESTINATION bin) diff --git a/README.md b/README.md index 2c8487cea..38fcf7974 100644 --- a/README.md +++ b/README.md @@ -140,7 +140,6 @@ others are external. Nine binaries are installed as part of Notcurses: * `ncls`: an `ls` that displays multimedia in the terminal -* `ncman`: a fancy manual browser * `ncneofetch`: a [neofetch](https://github.com/dylanaraps/neofetch) ripoff * `ncplayer`: renders visual media (images/videos) * `nctetris`: a tetris clone @@ -148,6 +147,7 @@ Nine binaries are installed as part of Notcurses: * `notcurses-info`: detect and print terminal capabilities/diagnostics * `notcurses-input`: decode and print keypresses * `notcurses-tester`: unit testing +* `tfman`: a fancy manual browser To run `notcurses-demo` from a checkout, provide the `data` directory via the `-p` argument. Demos requiring data files will otherwise abort. The base diff --git a/doc/man/index.html b/doc/man/index.html index f235644a1..f31f2b3ab 100644 --- a/doc/man/index.html +++ b/doc/man/index.html @@ -42,7 +42,6 @@ notcurses(3)—a blingful TUI library

Executables (section 1)

ncls—list files, displaying multimedia along with them
- ncman—swank man page browser
ncneofetch—generate low-effort posts for r/unixporn
ncplayer—renders images and video to a terminal
nctetris—Tetris in a terminal
@@ -52,6 +51,7 @@ notcurses-tester—unit test driver
ncdirect-pydemo—validates the Python direct-mode wrappers
notcurses-pydemo—validates the Python wrappers
+ tfman—swank man page browser

C library (section 3)

notcurses_capabilities—runtime capability detection
notcurses_cell—operations on nccell objects
diff --git a/doc/man/man1/ncman.1.md b/doc/man/man1/tfman.1.md similarity index 61% rename from doc/man/man1/ncman.1.md rename to doc/man/man1/tfman.1.md index 61a6423f4..ea32cdebc 100644 --- a/doc/man/man1/ncman.1.md +++ b/doc/man/man1/tfman.1.md @@ -1,18 +1,18 @@ -% ncman(1) +% tfman(1) % nick black % v3.0.0 # NAME -ncman - Swank manual page browser +tfman - Swank manual page browser # SYNOPSIS -**ncman** [**-h**] [**-V**] files +**tfman** [**-h**] [**-V**] files # DESCRIPTION -**ncman** displays manual pages ala **man(1)** using the Notcurses +**tfman** displays manual pages ala **man(1)** using the Notcurses (**notcurses(3)**) terminal UI library. # OPTIONS @@ -27,6 +27,10 @@ The following keypresses are recognized: * **Ctrl-L**: Redraw the screen. * **q**: Quit. +* **k**/**up**: Move up by one line. +* **b**/**pgup**: Move up by one page. +* **j**/**down**: Move down by one line. +* **f**/**pgdown**: Move down by one page. # NOTES diff --git a/src/lib/in.c b/src/lib/in.c index 97e78c75a..a66837eb1 100644 --- a/src/lib/in.c +++ b/src/lib/in.c @@ -1829,11 +1829,10 @@ ictx_independent_p(const inputctx* ictx){ } // try to lex a single control sequence off of buf. return the number of bytes -// consumed if we do so, and -1 otherwise. buf is almost certainly *not* -// NUL-terminated. if we are definitely *not* an escape, or we're unsure when -// we run out of input, return the negated relevant number of bytes, setting -// ictx->midescape if we're uncertain. we preserve a->used, a->state, etc. -// across runs to avoid reprocessing. +// consumed if we do so. otherwise, return the negative number of bytes +// examined. set ictx->midescape if we're uncertain. we preserve a->used, +// a->state, etc. across runs to avoid reprocessing. buf is almost certainly +// *not* NUL-terminated. // // our rule is: an escape must arrive as a single unit to be interpreted as // an escape. this is most relevant for Alt+keypress (Esc followed by the @@ -1846,6 +1845,7 @@ static int process_escape(inputctx* ictx, const unsigned char* buf, int buflen){ assert(ictx->amata.used < buflen); while(ictx->amata.used < buflen){ +fprintf(stderr, "AMATA USED: %u buflen: %d\n", ictx->amata.used, buflen); unsigned char candidate = buf[ictx->amata.used++]; unsigned used = ictx->amata.used; if(candidate >= 0x80){ @@ -1902,9 +1902,10 @@ process_escapes(inputctx* ictx, unsigned char* buf, int* bufused){ // if we aren't certain, that's not a control sequence unless we're at // the end of the tbuf, in which case we really do try reading more. if // this was not a sequence, we'll catch it on the next read. +fprintf(stderr, "ESCAPE PROC: %d %d %d MID: %u\n", *bufused, consumed, offset, ictx->midescape); if(consumed < 0){ int tavailable = sizeof(ictx->tbuf) - (offset + *bufused - consumed); - // if midescape is not set, the negative return menas invalid escape. if + // if midescape is not set, the negative return means invalid escape. if // there was space available, we needn't worry about this escape having // been broken across distinct reads. in either case, replay it to the // bulk input buffer; our automaton will have been reset. @@ -1919,15 +1920,17 @@ process_escapes(inputctx* ictx, unsigned char* buf, int* bufused){ memcpy(ictx->ibuf + ictx->ibufvalid, buf + offset, available); ictx->ibufvalid += available; } - *bufused -= consumed; offset += consumed; ictx->midescape = 0; + *bufused -= consumed; }else{ break; } } +fprintf(stderr, "TIME FOR BIG SUB %d - %d -> %d : %d\n", *bufused, consumed, *bufused - consumed, offset); *bufused -= consumed; offset += consumed; + assert(0 <= *bufused); } // move any leftovers to the front; only happens if we fill output queue, // or ran out of input data mid-escape @@ -2093,7 +2096,9 @@ process_ibuf(inputctx* ictx){ if(ictx->tbufvalid){ // we could theoretically do this in parallel with process_bulk, but it // hardly seems worthwhile without breaking apart the fetches of input. +fprintf(stderr, "TBUFVALID: %u\n", ictx->tbufvalid); process_escapes(ictx, ictx->tbuf, &ictx->tbufvalid); +fprintf(stderr, "TBUFVALIDPOST: %u\n", ictx->tbufvalid); } if(ictx->ibufvalid){ if(ictx_independent_p(ictx)){ diff --git a/src/man/main.c b/src/man/main.c index 20cbca8cc..f81b2cda3 100644 --- a/src/man/main.c +++ b/src/man/main.c @@ -32,7 +32,7 @@ parse_args(int argc, char** argv){ case 'h': usage(argv0, stdout); exit(EXIT_SUCCESS); break; - case 'V': fprintf(stderr, "ncman version %s\n", notcurses_version()); + case 'V': fprintf(stderr, "%s version %s\n", argv[0], notcurses_version()); exit(EXIT_SUCCESS); break; default: usage(argv0, stderr); @@ -956,7 +956,7 @@ done: } static int -ncman(struct notcurses* nc, const char* arg){ +tfman(struct notcurses* nc, const char* arg){ int r = manloop(nc, arg); return r; } @@ -975,7 +975,7 @@ int main(int argc, char** argv){ bool success; for(int i = 0 ; i < argc - nonopt ; ++i){ success = false; - if(ncman(nc, argv[nonopt + i])){ + if(tfman(nc, argv[nonopt + i])){ break; } success = true;