Commit Graph

1415 Commits (31bd01b56d0684f994bddefa409b7863da722811)

Author SHA1 Message Date
nick black 4347cd956a merge in master changes 4 years ago
nick black 9675ed251e
eagle demo: work with ascii mode #634 4 years ago
Marek Habersack 9ca8d9c9c6 Correctly cast `ncpp::Plane` to `ncplane*`
Fixes: https://github.com/dankamongmen/notcurses/issues/616

SIGSEGV was caused by an invalid cast.

Short explanation: PEBKAC

Long explanation: `Selector.hh`, `Plot.hh` and `MultiSelector.hh` did
not include `Plane.hh`, they merely declared `class Plane;` because
inclusion of `Plane.hh` would cause circular dependencies to appear and
the compiler would be unhappy.  On top of that, yours truly wrenched the
compiler's hands and caused it to believe that a pointer to `Plane` is
really a pointer to `ncplane*` which was quite a silly thing to do as
the compiler, not having included `Plane.hh` and thus not knowing full
definition of the type, wasn't able to look up the type cast operator in
`Plane`.

Don't abuse `reinterpret_cast`, kids!
4 years ago
nick black ba8d80d444
procroller: don't recurse on argv[0], whoops 4 years ago
nick black cce9384ab8
ncmetric: adapt PREFIXFMT to multibyte #630 4 years ago
nick black 4e9f46e063
Correct scaling in qrcode_rows() 4 years ago
nick black e682b4fae8
qrcode: only render sufficiently small codes #629 4 years ago
nick black f425944bba
FreeBSD: move back to getrandom(); read_random() is kernelspace 4 years ago
nick black 2b5546fc4c
plot: make 8x1 the default glyph geometry 4 years ago
nick black 7215bf92ad
throw somed attributes on a few functions 4 years ago
nick black 7e12436196
reader poc: fix Plane memory leak #624 4 years ago
nick black 57fb7fc96a
sgr poc: don't put critical logic in assert() #624 4 years ago
nick black f9f76046d5
sgr poc: don't put critical logic in assert() #624 4 years ago
nick black 4ab0e67155
tetris: rely on c++ exceptions #621 4 years ago
nick black 37a4114f42
O(1) z-axis moves #623
Replace the singly-linked z-axis with a doubly-linked list,
and reimplement all z-axis moves as O(1) functions.
Eliminate ncplane_move_{above/below}_unsafe(), as there are no
longer unsafe moves.
4 years ago
nick black 2edb7fe690
handle clang11 -Wc99-designator 4 years ago
nick black 3119a87801 init_banner(): need use stdio directly for styling 4 years ago
nick black 99bd3fd597
recenter post-rotation in normal demo #617 4 years ago
nick black bcdf513e31
direct poc: exit out on bad ncdirect_cursor_up() 4 years ago
nick black e5b1c2cdea
view/demo/tetris: NCOPTION_INHIBIT_SETLOCALE 4 years ago
nick black 818ec25778
notcurses_stop: call del_curterm, plug memory leak 4 years ago
nick black 7f2888269f
all PoCs: use NCOPTION_INHIBIT_SETLOCALE 4 years ago
nick black 381263e9fe
Unify interrogate_terminfo() #614 4 years ago
nick black 30412d54ce
ncreel: fix up rendering, reel display #618 4 years ago
nick black 8ff3402166
move terminfo cache into its own shared struct #614 4 years ago
nick black bd4d4ef321 import init_banner() outfactoring 4 years ago
nick black 390dc208ba freebsd: use read_random() 4 years ago
nick black 321908d824
ncplane_vprintf_prep(): remove dumb comment #612 4 years ago
nick black e80ac4ddb9
normal demo: work with odd number of columns :/ 4 years ago
nick black bad0ea9127
normal demo: reset underlying plane 4 years ago
nick black e2a9094ed0
notcurses_init(): drop_signals on error path 4 years ago
nick black d37a3934d1
normal-demo: get a nice scroll-opening 4 years ago
nick black 1337091c46
normal demo: get it mostly working 4 years ago
nick black bc7b58c5df
ncvisual_from_plane(): apply vertical scaling 4 years ago
nick black 8ec5388448
normal demo: use demodelay 4 years ago
nick black 30f049d2e6
metric: don't allow scales that cause overflow #611 4 years ago
nick black 0688b95c01
metric: properly print usuffix on small values 4 years ago
nick black eb72a4612d
qprefix/bprefix: use uintmax_t for decimal 4 years ago
nick black 3b9232217e
rotation: comment out some debugging cruft 4 years ago
nick black a6629e2ae8
handle_csi: translate mouse coordinates by margins #609 4 years ago
nick black 84c51d9bde
perfect exponential plots #606
Previously, we had the first interval top out at 1.0. This made
clean mathematical sense, but it meant that we wasted the lowest
|states - 1| representations. We now top out at ibase**(states - 1).
The very bottom representation tops out at 1, meaning that any data
is always distinguishable from no data. We no longer explicitly
print spaces (aka the zeroth state for each glyph clade), so that
we can exhibit more transparency. Properly account for miny at
all times. Slots in an exponential plot are now exponential
throughout; before, it was exponential across rows, and linear
within a row.
4 years ago
nick black 31cc26b893
xray demo: much simplification 4 years ago
nick black 25fee034cb
ncplot: print EGC before breaking on small glyph #605 4 years ago
nick black fe3d6b31e2
ncmetric: print prefix with %lc #540 4 years ago
nick black d1b5a39135 ncvisual_stream(): update python streamcb typedef 4 years ago
nick black c824e1ac02 ncvisual_stream(): update OIIO implementation #604 4 years ago
nick black 289b018612 view-demo: cleanup, opaque 4 years ago
nick black e751557936 debug(): stretch out headers/footers 4 years ago
nick black e36a42bb24 xray demo: adapt to new streaming API 4 years ago
nick black 78e30831dd move timespec 4 years ago
nick black 61aa09eae0
ncplane_rgba(): properly set up alpha channel 4 years ago
nick black 2c73162c62
notcurses-view: %jd + intmax_t for 32-bit 4 years ago
nick black 2588baa7db
reel: correct wchar_t check for error on 32-bit 4 years ago
nick black 7d87f8aa20
demo: printf changes for 32-bit archs 4 years ago
nick black 33997d1f06
ncplane_dup: ensure we dup base cell #593 4 years ago
nick black 1c2f92b3bc
ncmetric: replace u with µ, define *COLUMNS #540 4 years ago
nick black e3df2dca16
ncvisual_bounding_box(): always initialize lcol/rcol 4 years ago
nick black 5081ed048c
do an OIIO rotate() #559 4 years ago
nick black 1e9b4653d7
that's enough rotation for now 4 years ago
nick black 4d23b6c15e
normal: reenable ncvisual_from_plane() 4 years ago
nick black b796668044
qrcode: center qrcode 4 years ago
nick black 7aa488f419
ncvisual_rotate: perfect rotate_bounding_box() #599 4 years ago
nick black 18ba212709
qrcode demo: use arc4rand() on freebsd #601 4 years ago
nick black 45db9c2ac7
ncvisual_bounding_box(): fix rcol calculation #599 4 years ago
Nick Black f602c440a6
ncvisual_rotate() for arbitrary radians (#600)
* normal/visual: need dup stdplane for rotate
* add ncplane_center(), unit tests
* ncplane_center_abs(): add, unit tests
* ncvisual_bounding_box() for #599
* ncvisual_rotate(): works via bounding box #599
* normal demo: comment out broken section
* rotate: resize underlying plane as needed #599
* ncvisual_rotate: support negative rads #599
4 years ago
nick black 420ef740b1
drop geom.c prior to merge 4 years ago
nick black 9a80750316
notcurses_canopen: split into images/videos #598 4 years ago
nick black 99d05f67e7 add ncplane_center(), unit tests 4 years ago
nick black 219f6bdd27
ncvisual_rotate: move to arbitrary rads 4 years ago
nick black 0f5333f103
subtle ncplane bugfixes
ncplane_dup(): properly set target plane attributes/channels
ncplane_move_below_unsafe(): speedup, at most one traversal
ncplane_rgba(): accept null glyph
ncvisual_from_plane(): dup the plane, own it in ncvisual
normal: spin the visual
4 years ago
nick black 37454602f6
whiteout, uniblocks: explicitly skip if not UTF8 4 years ago
nick black 0bab14f654 tester: enable Visual tests #325 4 years ago
nick black 26a68096c8 blitter: work in ASCII encoding 4 years ago
nick black 7dae248a41 box demo: work in ASCII encoding #325 4 years ago
nick black 25baa10f72 special-case double/rounded boxes in ASCII #325 4 years ago
nick black 7b4ebed07d cache utf8 encoding check #325 4 years ago
nick black ea3ca7d503
demo: only move fpsgraph when grabbed #595 4 years ago
nick black 454806d53a extend notcurses_debug() 4 years ago
nick black f13478a72b remove age-old forgotten HUD hack #594 4 years ago
nick black 64d4981d36 scrub stdplane on demo loop #593 4 years ago
nick black 9f16034d02 add notcurses_debug() #594 4 years ago
nick black 3e1c9c05d4
demo: improve fpsplot colors 4 years ago
nick black 1075de7828
ncplot: restore non-exponential draw 4 years ago
nick black 8612461618 demo: move fpsplot with the mouse, hot holy shit #470 4 years ago
nick black 7e0a6cb581 demo: hud always exists, just hidden #591 4 years ago
nick black 19121e91f1 ncplot: implement exponential plots #470 4 years ago
nick black dd9f8254df ncplot: implement labels for exponentials #470 4 years ago
nick black a440382fb5 demo: use NCPLOT_OPTIONS_EXPOENTIALD #470 4 years ago
nick black 2cfa3bb3dc demo: hide fps plot by default, mention in help #470 4 years ago
nick black 1e0039aee2 demo: add menu option to toggle FPS plot #470 4 years ago
nick black cd8726e8ac demo-plot: use a translucent plot #470 4 years ago
nick black 53d924b374 ncplot: use same amount of space for all labels 4 years ago
nick black 7baca9615f demo: add fpsgraph along the bottom, AWESOME #470 4 years ago
nick black fbed12cd80
ncreel_options: add flag field #590 4 years ago
nick black 66bafd59b3
subproc, fdplane, plot, selector, mselector: flag words #590 4 years ago
nick black eaaa36f0c8
ncreader: ncplane as first arg #590 4 years ago
nick black 9446840b97
ncmenu: move to flag field #590 4 years ago
nick black fec423264f
selector: undo switch to notcurses from ncplane 4 years ago
nick black 4eb4c2909f
ncplane_erase(): only zero out gcluster #586 4 years ago
nick black f6a7adc7e8
reader PoC: print content on exit 4 years ago
nick black fcc73856cb
notcurses_init(): call setlocale unless INHIBIT_SETLOCALE #579 4 years ago
nick black 006f430e10
selector poc: kill #ifdef 4 years ago
nick black 95c17e52b0
freebsd: kill unused-param warning in ncsubproc 4 years ago
nick black dd044c96c8
tetris: replace cuserid with getpwuid #577 4 years ago
nick black d339b118f1 ncsubproc: decay to fork()/kill() on fbsd #574 4 years ago
nick black df90cb48b6
qrcode demo: compile with USE_QRCODEGEN=off 4 years ago
nick black aec982bca5
demo: use pipes, not eventfd, for input #578
FreeBSD doesn't support eventfd, and this isn't at all
performance-critical code, so just downgrade to pipe2()
across the board. I've verified that FreeBSD *does* have
pipe2(), so we should be good there.
4 years ago
nick black 50c7c5b0f4
ncreader: only advance if we emitted columns 4 years ago
nick black 2eb3c8ea13
reader: support arrow keys #585 4 years ago
nick black 2f4a0a2a98
ncreader_clear: remove unnecessary homing #585 4 years ago
nick black a1eb39906f
reader: support ctrl+u to clear input #585 4 years ago
nick black 95ba340fba
ncplane_erase: fix bug in basecell preservation 4 years ago
nick black 3eb99b2447
reader: advance/backspace across lines #585 4 years ago
nick black 5ba7a4b371
ncreader: support backspace horizontally #585 4 years ago
nick black 1cc2d8a359
ncmetric: no need to use localeconv decicep with %f #545 4 years ago
nick black 00be9ad2e6
ncmetric: use %f to simplify #545 4 years ago
nick black b59f623249
reader: %lc wants wint_t, not wchar_t 4 years ago
nick black d2c968b948
notcurses_init(): interpret NULL as /dev/tty #571 4 years ago
nick black abbda739d1
ncplane_contents(): plug up memory leak #580 4 years ago
nick black 1c394dc103 modernize c++ according to clang-tidy-11 4 years ago
nick black 0c3f5cf28e visual: modernize c++ for clang-tidy-11 4 years ago
nick black e2a94817e7 tests: lots of NULL->nullptr 4 years ago
nick black 5b0d773fb5 modernize some PoC c++ according to clang-tidy 4 years ago
nick black ba94919de7 rgbbg: modernize c++ 4 years ago
nick black 06e4b9f06b NEWS: mention ncplane_set_channels() 4 years ago
nick black 989ca7ff9a selector->ncselector, multiselector -> ncmultiselector #580 4 years ago
nick black 196de625c4 reader poc: render after each change to reader area #403 4 years ago
nick black d161e2eeb3 implement ncplane_content() #582 4 years ago
nick black e15055034e ncreader: set up tchannels/tattrword #403 4 years ago
nick black f2546c0949 reader poc: initialize ncreader_options #403 4 years ago
nick black 26db8a66b7 ncplane_set_attr()/ncplane_set_channels() 4 years ago
nick black c4bf483d8b ncreader_contents(): wrap ncplane_contents() #403 4 years ago
nick black 48de25821c ncreader man page #403 4 years ago
nick black 3f86b649aa view: use c++ getc 4 years ago
nick black 384bdf88b2 tetris: use C++ refresh() 4 years ago
nick black 980e0ff29a ncreader: use underscore by default #403 4 years ago
nick black 312e42add2 ncreader: C++ wrapper 4 years ago
nick black d174431187 ncreader_create: accept const options #403 4 years ago
nick black 7683973ee4 ncreader_options, bad options tests #403 4 years ago
nick black 4819c0e1c3 selector/multiselect: accept notcurses 4 years ago
nick black 064da8acb9 ncreader_destroy() / ncreader_plane() 4 years ago
nick black 5e1d8ccf75 ncreader introduced 4 years ago
nick black 88d14f2f9e
tetris: #include <array>, needed on freebsd #573 4 years ago
nick black dbdaebb3a4
notcurses-view: verify Notcurses::can_open() 4 years ago
nick black 52428b9f27
release.sh: search for OLDVERSION following sed 4 years ago
nick black 5d3d99c602
normal: don't produce unusable colors 4 years ago
nick black 94e42809fe
notcurses_resize(): kill unnecessary memset() 4 years ago
nick black fa865d1971
luigi: don't free garbage on error path 4 years ago
nick black 3384fad429
sliding demo: don't free garbage on error path 4 years ago
nick black a8b3780c21
demo: remove some unused vars 4 years ago
nick black ee196c299d
hud: plug memory leak on error path 4 years ago
nick black c958883a0e
fallin': plug memory leaks on error paths 4 years ago
nick black f3b9ff8de6
selector: properly free partial selector on error path 4 years ago
nick black ebe79eb339
ncplane_dup: return NULL on error path 4 years ago
nick black f466a45f8d
menu: fix free()s on error path 4 years ago
nick black 67048bf5fa
release-checklist: add scan-build invocation 4 years ago
nick black 1526cfc7b8
handle_getc(): check for NULL ni before writing ->alt 4 years ago
nick black e97d16b85f
plot.cpp: modernize return types 4 years ago
nick black 3f93d15cda
widestomp: apply clang-tidy-11 fixes 4 years ago
nick black 3aa0e482d3
ncplane_rgba: set up frame #559 4 years ago
nick black c96498de8a
ncplane_rgba(): check for validity of input #559 4 years ago
nick black 5bdfc0183f
ncvisual_from_plane() #559 4 years ago
nick black efc8c027a0
ncsubproc: harvest with waitpid(), pass up wstatus #554 4 years ago
nick black 94fcada67c
ncvisual_rotate: unify _cw/_ccw, take radians 4 years ago
nick black 20d0048838
CMake improvements/cleanup #565
Rather than inspecting CMAKE_BUILD_TYPE manually and setting
DEBUG_OPTIONS based off the results, set CMAKE_{C/CXX}_FLAGS_DEBUG,
and allow that to be picked up by CMake #565. Remove repeated -W
flags that were all over the place, making them global compiler
flags. Remove repeated FORTIFY=2 definition that was all over the
place, making it a global compiler definition. Remove all uses of
${DEBUG_FLAGS}. Also, since CMake doesn't define a CMAKE_BUILD_TYPE
by default, instead just setting neither debugging nor optimization
flags, in what seems a pretty fucking boneheaded move, set it by
default to RelWithDebInfo. ugh. Explicitly disuse unused PoC variables.
4 years ago
nick black 54154339f6
ncvisual_set_data() to track ncv->data for ownership 4 years ago
nick black 3e8cbca9e6
plug memory leak in whiteout demo 4 years ago
nick black b420722bfe
ncvisual_destroy() for null multimedia #568 4 years ago
nick black 102ff0a7ce
unify ncvisual_render() across ffmpeg/oiio #568 4 years ago
nick black 14fa7c350d
bgra_to_rgba(): remove obsolete assert #566 4 years ago
nick black 4446bbdf06
tria_blit(): interpret missing row as transparent #566 4 years ago
nick black f63325db60 Lots of ncvisual work
Unify ffmpeg/oiio/null implementations, where possible. This effectively
required placing all three in the same file, which meant they're all now
C++. Update FFmpeg implemenation to be C++-usable. Implement
ncvisual_rotate_cw() and ncvisual_rotate_ccw() #515. Move most of tetris
over to Visual from Plane #558. Add bgra_to_rgba(), necessary for
creating ncvisual from BGRA memory. Implement ncvisual_from_rgba()
and ncvisual_from_bgra() #557. Add unit tests on ncvisual rotation.
4 years ago
nick black f7e002d913 ncvisual_from_*: prefixes for all three modes #557 4 years ago
nick black 39548acc3a rename ncvisual_open_plane->ncvisual_from_file() #560 4 years ago
nick black 7e9cc29f8e add decls+docs for ncvisual_from_rgba/bgra #557 4 years ago
nick black 803296fb80 tetris: curpiece is now a Visual, not a Plane #558 4 years ago
nick black 0b22b561d2
notcurses-view: accept only valid -s arguments #563 4 years ago
Marek Habersack e23d5baea4 [C++] Sync API changes
Added:

  * class FDPlane (`ncfdplane*`)
  * class Subproc (`ncsubproc*`)
  * NotCurses: get_inputready_fd (`notcurses_inputready_fd`)
  * Plane: qrcode (`ncplane_qrcode`)
  * class PlotBase: templated base class for Plot variations
  * class PlotU: `uint64_t` instantiation of PlotBase (aliased to previous
    `Plot` class for source compatibility), `ncuplot*`
  * class PlotD: `double` instantiation of PlotBase, `ncdplot*`
4 years ago
nick black f14444cfca
multiselector: work in ASCII environment #451 4 years ago
nick black cd2cbd0d88
export enforce_utf8() via internal.h #451 4 years ago
nick black 4951a6876c
ncplane_putc_yx(): abstract to ncplane_cell_ref_yx() 4 years ago
nick black c0b2a64102
implement+doc notcurses_inputready_fd() #513 4 years ago
nick black fd86da5530
kill_and_wait_subproc: no NULL siginfo_t for waiid() 4 years ago
nick black c8322e6cb1
ncfdplane: on non-following planes, break out on 0 read 4 years ago
nick black b34fa9be41
python: proper ncfdplane/ncsubproc decls 4 years ago
nick black 5132b5b2b5
ncsubproc: unify thread implementations #553 4 years ago
nick black a23efbb463
rigourize ncsubproc destruction
We need support three distinct paths for destruction of
ncsubprocs: (1) external call to ncsubproc_destroy() while
the subprocess is running, (2) external call to
ncsubproc_destroy() after the subprocess has terminated, and
(3) internal call to ncsubproc_destroy() without any external
call. To do this properly, we always waitid() on the subprocess
in our ncsubproc thread, and do not cancel said thread. This
guarantees that the subprocess has been reaped if the thread
has exited. We throw a pidfd_send_signal() into the thread
prior to the waitid(), because this is safe with pidfds. The
thread reclaims no resources otherwise. ncsubproc_destroy(),
instead, reclaims them, after joining the ncsubproc thread.
It sends SIGKILL before the join, which is once again safe
thanks to pidfds. Resolves #552.
4 years ago
nick black 6e0fd72e33
proc/fileroller: don't call ncfdplane_destroy() from within callbacks 4 years ago
nick black e156bd42be
plot: match delete, not free, with new 4 years ago
nick black 6a774afb27
canchangecolor: don't allow ccc if too few colors are supported #539 4 years ago
nick black 84107c547d
view: support -m argument for margins #551 4 years ago
nick black 6e8a0bebae
view: support -k to inhibit alternate screen #551 4 years ago
nick black 6d500e8511
demo: for now, disable videos for OIIO 4 years ago
nick black 0d8f5d1b92
notcurses_reset_stats(): allow NULL for second parameter 4 years ago
nick black 86b526bdcb
demo: reset stats following initialization #522 4 years ago
nick black c136d27bd5
oiio: use seek_subimage to find EOF #549 4 years ago
nick black 317aa5baef
demo: grey out unsupported demos, but list them #521 4 years ago
nick black 2ec797c70c
notcurses-demo: build all demos regardless of build type #521 4 years ago
nick black 86ec4af810
oiio: no need to perform explicit seek_subimage #547 4 years ago
nick black 4fcd7edd1f
subprocs: exit() on dup() failure in child #537 4 years ago