fix: Allow n() function to count (empty) cells off edge of sheet (#84)

Resolves #83.

Co-authored-by: Glen Whitney <glen@studioinfinity.org>
Reviewed-on: #84
This commit is contained in:
Glen Whitney 2023-04-09 19:28:57 +00:00
parent d38cf2b913
commit 34e8b99585
3 changed files with 17 additions and 6 deletions

View File

@ -93,3 +93,8 @@ include(CPack)
if (NOT CMAKE_BUILD_TYPE) if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE MinSizeRel CACHE STRING "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." FORCE) set(CMAKE_BUILD_TYPE MinSizeRel CACHE STRING "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." FORCE)
endif () endif ()
add_custom_target(
print_build_type
COMMAND ${CMAKE_COMMAND} -E echo $<$<CONFIG:>:Undefined>$<$<NOT:$<CONFIG:>>:$<CONFIG>>
)

View File

@ -8463,7 +8463,14 @@ l1
l1 l1
\emph default \emph default
defaults to the current location. defaults to the current location.
The second form simply returns the number of its arguments which are nonempty. If any dimension of either location is negative, that component is simply
taken as 0.
In other words, locations off the sheet are considered empty, but it is
not an error to access them.
\begin_inset Newline newline
\end_inset
The second form simply returns the number of its arguments which are nonempty.
\end_layout \end_layout
\begin_layout Description \begin_layout Description

View File

@ -30,16 +30,15 @@
#include "utf8.h" #include "utf8.h"
/*}}}*/ /*}}}*/
/* posorder -- sort two integers */ /*{{{*/ /* posorder -- sort two integers, clamping each to be nonnegative. */ /*{{{*/
void posorder(int *x, int *y) void posorder(int *x, int *y)
{ {
assert(x != (int*)0); assert(x != (int*)0);
assert(*x >= 0);
assert(y != (int*)0); assert(y != (int*)0);
assert(*y >= 0); if (*x < 0) *x = 0;
if (*y < 0) *y = 0;
if (*x > *y) if (*x > *y) {
{
int t = *x; int t = *x;
*x = *y; *x = *y;
*y = t; *y = t;