mirror of
git://git.sv.gnu.org/nano.git
synced 2024-11-22 12:51:23 +03:00
make some ints that use the value of fill and can be greater than COLS
ssize_t's for consistency, and add a few minor cosmetic fixes git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1938 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
This commit is contained in:
parent
e6ef8b9bb9
commit
d08348b99c
@ -71,6 +71,10 @@ CVS code -
|
||||
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)
|
||||
|
@ -312,8 +312,6 @@ AC_FUNC_VPRINTF
|
||||
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)
|
||||
@ -349,7 +347,7 @@ fi
|
||||
|
||||
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"
|
||||
|
||||
|
12
src/nano.c
12
src/nano.c
@ -2137,7 +2137,7 @@ filestruct *backup_lines(filestruct *first_line, size_t par_len, size_t
|
||||
}
|
||||
|
||||
/* 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))
|
||||
@ -2158,14 +2158,12 @@ bool breakable(const char *line, int goal)
|
||||
* 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);
|
||||
@ -2391,7 +2389,7 @@ void do_justify(bool full_justify)
|
||||
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
|
||||
|
@ -34,22 +34,23 @@
|
||||
#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
|
||||
|
||||
|
@ -344,8 +344,8 @@ bool inpar(const char *str);
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user