reorder functions
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3073 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
7e2d673b5f
commit
c359301955
46
src/help.c
46
src/help.c
|
@ -356,29 +356,6 @@ void help_init(void)
|
||||||
assert(strlen(help_text) <= allocsize + 1);
|
assert(strlen(help_text) <= allocsize + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Calculate the next line of help_text, starting at ptr. */
|
|
||||||
size_t help_line_len(const char *ptr)
|
|
||||||
{
|
|
||||||
int help_cols = (COLS > 24) ? COLS - 8 : 24;
|
|
||||||
|
|
||||||
/* Try to break the line at (COLS - 8) columns if we have more than
|
|
||||||
* 24 columns, and at 24 columns otherwise. */
|
|
||||||
size_t retval = break_line(ptr, help_cols, TRUE);
|
|
||||||
size_t retval_save = retval;
|
|
||||||
|
|
||||||
/* Get the length of the entire line up to a null or a newline. */
|
|
||||||
while (*(ptr + retval) != '\0' && *(ptr + retval) != '\n')
|
|
||||||
retval += move_mbright(ptr + retval, 0);
|
|
||||||
|
|
||||||
/* If the entire line doesn't go more than 8 columns beyond where we
|
|
||||||
* tried to break it, we should display it as-is. Otherwise, we
|
|
||||||
* should display it only up to the break. */
|
|
||||||
if (strnlenpt(ptr, retval) > help_cols + 8)
|
|
||||||
retval = retval_save;
|
|
||||||
|
|
||||||
return retval;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Our dynamic, shortcut-list-compliant help function. */
|
/* Our dynamic, shortcut-list-compliant help function. */
|
||||||
void do_help(void)
|
void do_help(void)
|
||||||
{
|
{
|
||||||
|
@ -514,4 +491,27 @@ void do_help(void)
|
||||||
help_text = NULL;
|
help_text = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Calculate the next line of help_text, starting at ptr. */
|
||||||
|
size_t help_line_len(const char *ptr)
|
||||||
|
{
|
||||||
|
int help_cols = (COLS > 24) ? COLS - 8 : 24;
|
||||||
|
|
||||||
|
/* Try to break the line at (COLS - 8) columns if we have more than
|
||||||
|
* 24 columns, and at 24 columns otherwise. */
|
||||||
|
size_t retval = break_line(ptr, help_cols, TRUE);
|
||||||
|
size_t retval_save = retval;
|
||||||
|
|
||||||
|
/* Get the length of the entire line up to a null or a newline. */
|
||||||
|
while (*(ptr + retval) != '\0' && *(ptr + retval) != '\n')
|
||||||
|
retval += move_mbright(ptr + retval, 0);
|
||||||
|
|
||||||
|
/* If the entire line doesn't go more than 8 columns beyond where we
|
||||||
|
* tried to break it, we should display it as-is. Otherwise, we
|
||||||
|
* should display it only up to the break. */
|
||||||
|
if (strnlenpt(ptr, retval) > help_cols + 8)
|
||||||
|
retval = retval_save;
|
||||||
|
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* !DISABLE_HELP */
|
#endif /* !DISABLE_HELP */
|
||||||
|
|
|
@ -313,8 +313,8 @@ void thanks_for_all_the_fish(void);
|
||||||
/* Public functions in help.c. */
|
/* Public functions in help.c. */
|
||||||
#ifndef DISABLE_HELP
|
#ifndef DISABLE_HELP
|
||||||
void help_init(void);
|
void help_init(void);
|
||||||
size_t help_line_len(const char *ptr);
|
|
||||||
void do_help(void);
|
void do_help(void);
|
||||||
|
size_t help_line_len(const char *ptr);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Public functions in move.c. */
|
/* Public functions in move.c. */
|
||||||
|
|
Loading…
Reference in New Issue