commit 286c8778535c2eb47f3a4cfefbb90cc6fbb16b60
parent 8613285321c02d2c1fc5466246b4ec76706c603c
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Fri, 19 Apr 2019 09:44:57 +0200
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.
Diffstat:
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/nano.c b/src/nano.c
@@ -1920,7 +1920,7 @@ void do_output(char *output, size_t output_len, bool allow_cntrls)
#ifdef ENABLE_WRAPPING
/* 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;
#endif
}
diff --git a/src/proto.h b/src/proto.h
@@ -524,7 +524,7 @@ void update_undo(undo_type action);
#endif /* !NANO_TINY */
#ifdef ENABLE_WRAPPING
void wrap_reset(void);
-bool do_wrap(linestruct *line);
+bool do_wrap(void);
#endif
#if defined(ENABLE_HELP) || defined(ENABLED_WRAPORJUSTIFY)
ssize_t break_line(const char *line, ssize_t goal, bool snap_at_nl);
diff --git a/src/text.c b/src/text.c
@@ -1419,9 +1419,11 @@ void wrap_reset(void)
prepend_wrap = FALSE;
}
-/* Try wrapping the given line. Return TRUE if wrapped, FALSE otherwise. */
-bool do_wrap(linestruct *line)
+/* Try to wrap the current line. Return TRUE if wrapped, FALSE otherwise. */
+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);
/* The length of the line we wrap. */
ssize_t wrap_loc;
@@ -1472,8 +1474,6 @@ bool do_wrap(linestruct *line)
add_undo(SPLIT_BEGIN);
#endif
- openfile->current = line;
-
/* Step 2, making the new wrap line. It will consist of indentation
* 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)
@@ -3342,7 +3342,7 @@ void complete_a_word(void)
/* If needed, reenable wrapping and wrap the current line. */
if (was_set_wrapping) {
SET(BREAK_LONG_LINES);
- do_wrap(openfile->current);
+ do_wrap();
}
#endif
/* Set the position for a possible next search attempt. */