Depending on the Linux distro, ncurses may be built with tinfo as a
separate library that needs to be explicitly linked, or it may not.
Trying to pass -ltinfo when you don't need to might cause a linking
error. Failing to pass -ltinfo when you need to might cause a linking
error. And you might need to pass -ltinfow instead of -ltinfo, or you
might not. And if you get that wrong, you might cause a linking error.
This commit adds use pkg-config to the tool build script, attempting to
discover what args to use. This is only done on Linux. On other
platforms, or if pkg-config returns an error, we use the same hard-coded
options as before: -lncursesw -lformw
This probably adds about 5 or 10 milliseconds to the execution time of
the tool script.
J and Y and now be chained (like YYYYYY) to copy a glyph across the
'wire' they form.
This is a simple implementation of the feature. This changes both J and Y to
have loops in their definitions, instead of being single reads and
writes, which will make them heavier and have a adverse effect on
benchmarks. It also makes it harder to explain how orca's VM works,
since these operators are now non-trivial and can't be used as examples
of trivial operators. But we've decided it's worth it.
Qform (the popup text entry thing) is currently only used as a single
modal text input, but the TUI code still went through the motions of
setting each one up as if it could have a variety of things inside of
it. This commit saves on repeated code by providing a wrapper that does
the thing we want, but still leaves the door open in the future for
having other types of inputs in the form.
It also renames a few Qform functions for consistency.
This attribute macro, ORCA_OPT_MINSIZE, isn't currently in use in any of
the code, though it occasionally gets used when testing things. I had
previously only tested this under clang, and hadn't tested it under gcc.
Some of the syntax was missing for gcc's version. This commit fixes it.
This removes the limitation of having a hard-coded maximum number of
entries. There is no cost to code size. Iteration speed across Qnav
blocks may be slightly slower, because the elements are allocated in
arbitrary heap locations, which may prevent the next item from being
prefetched across links. But, there are rarely more than 3 entries, and
most of the time there are 0 entries. Iteration occurs only when
redrawing the Qnav blocks and when quitting.
We use a doubly linked list instead of singly linked because we need
quick access to the top entry while also needing to iterate from the
bottom to top when drawing the entries.
An equivalent implementation with a stretchy/dynamic array of pointers
was made, but the code size was larger and required more error checks
and an extra heap allocation.
A theoretical implementation that wants to reduce heap fragmentation
could use a contiguous or slab allocation of multiple Qnav blocks/items.
This would probably require more code, but may be worth it if this
menuing/widget system is extended for reuse across projects in the
future.
For now, we separately heap allocate each Qnav item and link them
together. Not great, but we don't have to worry about picking an
arbitrary count for an array of pointers, and we aren't increasing the
code size or complexity. Those are important things for this project.
This commit implements the Qnav/Qmenu system directly in ncurses,
replacing the old implementation which relied on the 'menu' library.
The new code is shorter, easier to read, and doesn't need the 'menu'
library to be linked.
For users, the behavior of the menus should be the same.
We still rely on the 'form' library for text field input in the menus.
Don't need to include all of the text. It was making the readme harder
to scroll through. This also wraps that block with a sup tag, which is
meant to make the text smaller. Might remove it if it causes problems.
ged_mouse_event() is never called when building with --no-mouse or when
defining FEAT_NOMOUSE. This could cause compilers to issue a warning.
This commit adds the ORCA_OK_IF_UNUSED decoration to ged_mouse_event(),
which should suppress the warning on most compilers. This intentionally
leaves the code compiled in. This is to avoid interleaving more ifdefs
than necessary into the code and making development and compile-time
errors more difficult to deal with.
Inputs on the right side of the operator are not marked with PARAM
(which denotes a haste input). This fixes the display of the variable
operator so that the text on the right is displayed white and not cyan;
which matches Orca.
*mingw32*.exe will not build the orca TUI correctly, though it may build
the CLI. If the compiler name isn't specified, like with `-c gcc`, then
it may default to the CC environment variable, which may be set to mingw
gcc instead of 'regular' cygwin gcc. This patch to `tool` fixes this
issue by guarding against the two known names of the mingw compiler .exe
when the detected OS is cygwin, and ignoring them, and instead
specifying `gcc` directly (unless overridden by the user with the `-c`
option.)