in help_line_len(), properly handle the case where we can't break the
line of help text, and wrap the line of help text at (COLS - 1) instead of (COLS - 8), for consistency git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3666 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
832994804e
commit
186c795b88
|
@ -267,6 +267,12 @@ CVS code -
|
||||||
consistency with the file browser. (DLR, suggested by Benno
|
consistency with the file browser. (DLR, suggested by Benno
|
||||||
Schulenberg)
|
Schulenberg)
|
||||||
- Remove redundant key checks. (DLR)
|
- Remove redundant key checks. (DLR)
|
||||||
|
help_line_len()
|
||||||
|
- Properly handle the case where we can't break the line of help
|
||||||
|
text. (DLR)
|
||||||
|
- Wrap the line of help text at (COLS - 1) instead of
|
||||||
|
(COLS - 8), for consistency. (DLR, suggested by Benno
|
||||||
|
Schulenberg)
|
||||||
- nano.c:
|
- nano.c:
|
||||||
print1opt_full()
|
print1opt_full()
|
||||||
- Rename to print_opt_full(), for consistency. (DLR)
|
- Rename to print_opt_full(), for consistency. (DLR)
|
||||||
|
|
11
src/help.c
11
src/help.c
|
@ -596,21 +596,22 @@ void parse_help_input(int *kbinput, bool *meta_key, bool *func_key)
|
||||||
/* Calculate the next line of help_text, starting at ptr. */
|
/* Calculate the next line of help_text, starting at ptr. */
|
||||||
size_t help_line_len(const char *ptr)
|
size_t help_line_len(const char *ptr)
|
||||||
{
|
{
|
||||||
int help_cols = (COLS > 24) ? COLS - 8 : 24;
|
int help_cols = (COLS > 24) ? COLS - 1 : 24;
|
||||||
|
|
||||||
/* Try to break the line at (COLS - 8) columns if we have more than
|
/* Try to break the line at (COLS - 1) columns if we have more than
|
||||||
* 24 columns, and at 24 columns otherwise. */
|
* 24 columns, and at 24 columns otherwise. */
|
||||||
size_t retval = break_line(ptr, help_cols, TRUE);
|
ssize_t wrap_loc = break_line(ptr, help_cols, TRUE);
|
||||||
|
size_t retval = (wrap_loc < 0) ? 0 : wrap_loc;
|
||||||
size_t retval_save = retval;
|
size_t retval_save = retval;
|
||||||
|
|
||||||
/* Get the length of the entire line up to a null or a newline. */
|
/* Get the length of the entire line up to a null or a newline. */
|
||||||
while (*(ptr + retval) != '\0' && *(ptr + retval) != '\n')
|
while (*(ptr + retval) != '\0' && *(ptr + retval) != '\n')
|
||||||
retval += move_mbright(ptr + retval, 0);
|
retval += move_mbright(ptr + retval, 0);
|
||||||
|
|
||||||
/* If the entire line doesn't go more than 8 columns beyond where we
|
/* If the entire line doesn't go more than 1 column beyond where we
|
||||||
* tried to break it, we should display it as-is. Otherwise, we
|
* tried to break it, we should display it as-is. Otherwise, we
|
||||||
* should display it only up to the break. */
|
* should display it only up to the break. */
|
||||||
if (strnlenpt(ptr, retval) > help_cols + 8)
|
if (strnlenpt(ptr, retval) > help_cols + 1)
|
||||||
retval = retval_save;
|
retval = retval_save;
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
|
|
Loading…
Reference in New Issue