tweaks: elide an unneeded parameter, as the function already assumes it

The do_wrap() function always gets 'openfile->current' as parameter,
and, internally, it assumes that it is handling the current line.
master
Benno Schulenberg 2019-04-19 09:44:57 +02:00
parent 8613285321
commit 286c877853
3 changed files with 7 additions and 7 deletions

View File

@ -1920,7 +1920,7 @@ void do_output(char *output, size_t output_len, bool allow_cntrls)
#ifdef ENABLE_WRAPPING #ifdef ENABLE_WRAPPING
/* If text gets wrapped, the edit window needs a refresh. */ /* If text gets wrapped, the edit window needs a refresh. */
if (ISSET(BREAK_LONG_LINES) && do_wrap(openfile->current)) if (ISSET(BREAK_LONG_LINES) && do_wrap())
refresh_needed = TRUE; refresh_needed = TRUE;
#endif #endif
} }

View File

@ -524,7 +524,7 @@ void update_undo(undo_type action);
#endif /* !NANO_TINY */ #endif /* !NANO_TINY */
#ifdef ENABLE_WRAPPING #ifdef ENABLE_WRAPPING
void wrap_reset(void); void wrap_reset(void);
bool do_wrap(linestruct *line); bool do_wrap(void);
#endif #endif
#if defined(ENABLE_HELP) || defined(ENABLED_WRAPORJUSTIFY) #if defined(ENABLE_HELP) || defined(ENABLED_WRAPORJUSTIFY)
ssize_t break_line(const char *line, ssize_t goal, bool snap_at_nl); ssize_t break_line(const char *line, ssize_t goal, bool snap_at_nl);

View File

@ -1419,9 +1419,11 @@ void wrap_reset(void)
prepend_wrap = FALSE; prepend_wrap = FALSE;
} }
/* Try wrapping the given line. Return TRUE if wrapped, FALSE otherwise. */ /* Try to wrap the current line. Return TRUE if wrapped, FALSE otherwise. */
bool do_wrap(linestruct *line) bool do_wrap(void)
{ {
linestruct *line = openfile->current;
/* The line that will be wrapped, if needed and possible. */
size_t line_len = strlen(line->data); size_t line_len = strlen(line->data);
/* The length of the line we wrap. */ /* The length of the line we wrap. */
ssize_t wrap_loc; ssize_t wrap_loc;
@ -1472,8 +1474,6 @@ bool do_wrap(linestruct *line)
add_undo(SPLIT_BEGIN); add_undo(SPLIT_BEGIN);
#endif #endif
openfile->current = line;
/* Step 2, making the new wrap line. It will consist of indentation /* Step 2, making the new wrap line. It will consist of indentation
* followed by the text after the wrap point, optionally followed by * followed by the text after the wrap point, optionally followed by
* a space (if the text after the wrap point doesn't end in a blank) * a space (if the text after the wrap point doesn't end in a blank)
@ -3342,7 +3342,7 @@ void complete_a_word(void)
/* If needed, reenable wrapping and wrap the current line. */ /* If needed, reenable wrapping and wrap the current line. */
if (was_set_wrapping) { if (was_set_wrapping) {
SET(BREAK_LONG_LINES); SET(BREAK_LONG_LINES);
do_wrap(openfile->current); do_wrap();
} }
#endif #endif
/* Set the position for a possible next search attempt. */ /* Set the position for a possible next search attempt. */