diff --git a/src/nano.c b/src/nano.c index 5ad59b9c..4f310b68 100644 --- 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 index c695d1a5..5fb1ca74 100644 --- 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 index aa39ebe1..aaff3094 100644 --- 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. */