Commit Graph

1001 Commits

Author SHA1 Message Date
Marek Habersack
64eeb95f1e [C++] Optionally enable throwing exceptions on errors
Nick prefers error handling based on exceptions in all cases, while I
prefer to save exception handling for truly exceptional situations -
function parameter validation and class constructor. However, there's no
need to not support both approaches, to be chosen at the discretion of
the developer.

NCPP follows RAII and all classes throw exceptions from their
constructors in case they cannot initialize properly. Likewise,
functions taking pointers that are required validate them and throw
exceptions whenever the requirement isn't met.

This commit goes one step further in that it enables optional validation
of notcurses function return values and throwing an
exception (`ncpp::call_error`) should the function signal an error. This
is disabled by default but it can be enabled by defining the
`NCPP_EXCEPTIONS_PLEASE` macro (preferably on the command line or
before *each* inclusion of any NCPP headers).

Out of necessity, this breaks the ABI (plus I found a handful of minor
issues in the code), but I think it's worth having this support in
place.
2020-04-15 12:10:14 -04:00
nick black
a5a2b5646a add PoC scroller #443 2020-04-15 11:37:57 -04:00
nick black
327c9cba78 Scrolling! all unit tests work #443 2020-04-15 11:37:57 -04:00
nick black
b385feef8f zero out newly-scrolled lines #443 2020-04-15 11:37:57 -04:00
nick black
646bcf3db2 finish out ScrollingOffBottom test #443 2020-04-15 11:37:57 -04:00
nick black
40067c0ccd interpret logical plane line via scrolled_row() #443 2020-04-15 11:37:57 -04:00
nick black
a7d9220f21 cell_load(): recycle when possible #473 2020-04-14 10:07:33 -04:00
nick black
45b821645a Only left sides of wide glyphs are 2 columns
At various places in rendering and rasterizing, we advance two
columns upon encountering a wide glyph. When dealing with a
single plane, this is always correct, because we're always
hitting the first column of the multicolumn glyph. Once multiple
planes are brought into play, though, we can very much hit the
second column of said glyph, in which case we mustn't advance
two columns, but only one. Resolves #474 by way of #475. w00t!
2020-04-14 05:17:16 -04:00
nick black
c934c7be49
colons in output 2020-04-13 20:43:09 -04:00
nick black
bd08712a0e
highcon: hoist out loop for great speedup #468 2020-04-13 18:39:25 -04:00
nick black
14184e8dbb
summary: use colons rather than slashes for emit:elide 2020-04-13 18:30:20 -04:00
nick black
b0fc654444 Check that cell is not wide right in render #362 2020-04-12 07:07:02 -04:00
nick black
b0aa6b9a7f simplify wide handling in putc_yx #362 2020-04-12 07:07:02 -04:00
Marek Habersack
28976dfef2 [C++] Sync API changes
Been a while, but here goes, sync to the latest API changes.

Added:

  * Direct:   cursor_{up,left,right,down} (`ncdirect_cursor_{up,left,right,down}`)
  * Plane: constructors to use `ncplane_bound`
  * Plane: reparent (`ncplane_reparent`)
  * Plot: definition of `default_options`

Changed:

  * Plane (breaking): the `*gradient*` functions now return `int`
  * Plane (breaking): `polyfill` returns `int`
  * Plane (breaking): `stain` returns `int`
  * Plane (breaking): `blit_bgrx` takes `const void*` for `data`
  * Plane (breaking): `blit_rgba` takes `const void*` for `data`
  * Plot: `plot_optons` -> `ncplot_options`
  * Plot (breaking): `{add,set}_sample` now return `bool`
2020-04-11 20:44:25 -04:00
nick black
33e4341a67 tetris: use background from installed path #466 2020-04-10 18:05:19 -04:00
nick black
f9c85442cd
poc sgr: purge unused variable 2020-04-10 13:00:53 -04:00
nick black
1d0e2d6fd6
pocs (selector/multiselec) kill unused label 2020-04-10 13:00:12 -04:00
nick black
1ccfd9b962
menu poc: remove unused variable 2020-04-10 12:58:48 -04:00
nick black
7d80e81a27
geom: remove unused variables 2020-04-10 12:58:04 -04:00
nick black
be2be9442a
better colors on notcurses-input plot 2020-04-08 21:32:41 -04:00
nick black
f08bbf83a7
notcurses-input: join ticker thread on exit 2020-04-08 21:29:24 -04:00
nick black
b04a37c433
plots: always start from the right #457 2020-04-08 21:26:15 -04:00
nick black
cfdd8c4c5c
plot: remove unused windowbase field 2020-04-08 18:32:36 -04:00
nick black
bdfcdf4086
get pydemo working again #459 2020-04-08 14:37:10 -04:00
nick black
cb7e844db1 unify notcurses-input+notcurses-keyplot #455 2020-04-08 09:39:10 -04:00
nick black
2c2da61c72
ncdirect: add relative move functions #419 2020-04-08 09:07:49 -04:00
nick black
3649cd1a92
notcurses_resize(): fix bug, reclaim 10% perf loss 2020-04-08 08:14:15 -04:00
nick black
a7e6e83711
notcurses_resize(): purge from public API #367 2020-04-08 07:38:42 -04:00
nick black
78142bcddc Tetris: import version.h for USE_FFMPEG 2020-04-08 05:54:03 -04:00
nick black
a54cc6c85f fix rgbbg PoC for scrolling era 2020-04-08 05:48:51 -04:00
Nick Black
c2a645e9af
Rust wrapper work (#454)
* packaging: s/libtinfo/Terminfo/g
* rust: add stddim_yx()
* rust: check for valid init in unit tests
* rust: serialize up tests
* constify notcurses_term_dim_yx()
* rust: add dim wrappers
* remove notcurses_resize() from public API #367
* call notcurses_resize() from notcurses_refresh() #367
2020-04-08 05:39:41 -04:00
Nick Black
d66549d362
Prep for Fedora packaging (#452)
* jungle demo should be available outside of DFSG builds
* libav: blitters don't need FFMpeg
* CMake: threads independent of ffmpeg
* CMake: add USE_TESTS option to disable tests #450
* tetris: work without ffmpeg
* fedora: flesh out specfile #328
* menu poc: don't use ffmpeg at all
* compile PoCs with binary/include
* multiselect PoC: work without ffmpeg
2020-04-08 02:12:46 -04:00
nick black
fffc1ee850
Extract colloquy; it's gone to its new home #320 2020-04-08 00:12:35 -04:00
nick black
312d15d0f9
mathtext poc: enable scrolling 2020-04-07 16:20:08 -04:00
nick black
2852ff736c
tetris: factor out MoveLateral() 2020-04-07 16:00:32 -04:00
nick black
c38981ee59
ncplot work #445 #448
Tighten up interval arithmetic. Render the plot immediately upon
creation so that the labels are visible. Properly perform domain
detection on miny by initializing it to 2^64-1. Handle plotting
when miny > maxy, as it now will be upon creation when using
domain detection (#448). Add spaces as the first element of each
glyph cycle (#445).
2020-04-06 03:32:40 -04:00
nick black
0a8e5ef70d
notcurses_keyplot: error out on null ncplot 2020-04-06 02:59:35 -04:00
nick black
77dd998b05
ncplot uses exclusively non-negative samples #447 2020-04-06 02:39:56 -04:00
nick black
85c568b3a4
ncplot: redraw upon creation so axis labels are visible 2020-04-06 02:20:21 -04:00
nick black
5c44416426
export ncplane_putstr_yx() as static inline 2020-04-06 01:15:20 -04:00
nick black
4a6ab358ba inline ncplane_putsimple_yx() 2020-04-05 23:54:38 -04:00
nick black
37b4d96794 whiteout: update for scrolling semantics #323 2020-04-05 23:54:38 -04:00
nick black
dc14483878 implement scrolling #323 2020-04-05 23:54:38 -04:00
nick black
6138ff2832 xray: fix up for scrolling 2020-04-05 23:54:38 -04:00
nick black
0ee1779e82 ncplane_putstr_yx(): kill useless cell prep and FIXME 2020-04-05 23:54:38 -04:00
nick black
b3710bd87e drop _locked() from ncplane_cursor_move_yx() 2020-04-05 23:54:38 -04:00
nick black
0ddb3c0002 implement ncplane_set_scrolling() #323 2020-04-05 23:54:38 -04:00
nick black
df3dc6b5bc
prep for 1.2.5 2020-04-04 18:49:16 -04:00
nick black
4917603478
ncplot: swap NCPLOT_2x1 and NCPLOT_1x1x4 2020-04-04 13:00:27 -04:00
nick black
3e202d6fa6 label dependent axis when requested #438 2020-04-04 12:32:19 -04:00