do_para_begin(), do_para_end()
- Maintain current_y's value when moving up or down lines so
that smooth scrolling works correctly. (DLR)
+ breakable(), break_line()
+ - Make goal a ssize_t instead of an int, since fill is now a
+ ssize_t, and the position at which a line is broken can be
+ greater than COLS. (DLR)
- nano.h:
- Add WIDTH_OF_TAB #define, containing the default width of a
tab. (DLR)
AC_CHECK_FUNCS(getopt_long)
dnl Checks for libraries.
-
-
if eval "test x$CURSES_LIB_NAME = x"
then
AC_CHECK_HEADERS(curses.h ncurses.h)
AC_CHECK_LIB([$CURSES_LIB_NAME], use_default_colors, AC_DEFINE(HAVE_USE_DEFAULT_COLORS, 1, [Define this if your curses library has the use_default_colors command.]))
-dnl Parse any configure options
+dnl Parse any configure options.
LIBS="$LIBS $CURSES_LIB"
}
/* Is it possible to break line at or before goal? */
-bool breakable(const char *line, int goal)
+bool breakable(const char *line, ssize_t goal)
{
for (; *line != '\0' && goal >= 0; line++) {
if (isblank(*line))
* such space, and force is TRUE, then we find the first space. Anyway,
* we then take the last space in that group of spaces. The terminating
* '\0' counts as a space. */
-int break_line(const char *line, int goal, bool force)
+int break_line(const char *line, ssize_t goal, bool force)
{
- /* Note that we use int instead of size_t, since goal is at most
- * COLS, the screen width, which will always be reasonably small. */
- int space_loc = -1;
+ ssize_t space_loc = -1;
/* Current tentative return value. Index of the last space we
* found with short enough display width. */
- int cur_loc = 0;
+ ssize_t cur_loc = 0;
/* Current index in line. */
assert(line != NULL);
size_t line_len;
size_t display_len;
/* The width of current in screen columns. */
- int break_pos;
+ ssize_t break_pos;
/* Where we will break the line. */
/* We'll be moving to the next line after justifying the
#include <limits.h>
#endif
-/* Macros for the flags long... */
+/* Macros for the flags long. */
#define SET(bit) flags |= bit
#define UNSET(bit) flags &= ~bit
#define ISSET(bit) ((flags & bit) != 0)
#define TOGGLE(bit) flags ^= bit
-/* Define charalloc as a macro rather than duplicating code */
+/* Macros for character allocation. */
#define charalloc(howmuch) (char *)nmalloc((howmuch) * sizeof(char))
#define charealloc(ptr, howmuch) (char *)nrealloc(ptr, (howmuch) * sizeof(char))
#define charmove(dest, src, n) memmove(dest, src, (n) * sizeof(char))
+
#ifdef BROKEN_REGEXEC
#define regexec(preg, string, nmatch, pmatch, eflags) regexec_safe(preg, string, nmatch, pmatch, eflags)
#endif
#ifndef NANO_SMALL
-/* For the backup file copy ... */
+/* For the backup file copy. */
#define COPYFILEBLOCKSIZE 1024
#endif
void do_para_end(void);
filestruct *backup_lines(filestruct *first_line, size_t par_len, size_t
quote_len);
-bool breakable(const char *line, int goal);
-int break_line(const char *line, int goal, bool force);
+bool breakable(const char *line, ssize_t goal);
+ssize_t break_line(const char *line, ssize_t goal, bool force);
bool do_para_search(size_t *const quote, size_t *const par);
void do_justify(bool full_justify);
void do_justify_void(void);