Call something a buffer when it refers to a linked list of linestructs,
and call something a linestruct when it is a struct that describes a
single line.
When the user chooses not to open a file that some message refers to,
remove all messages for that file from the linting results, so the user
does not get asked about that same file again.
This fixes https://savannah.gnu.org/bugs/?47130.
The interval 2013-2017 for the Free Software Foundation is valid
because in those years there were releases with changes by either
Chris or David, and the GNU maintainers guide advises to mention
a new year in all files of a package, not just in the ones that
actually changed, and be done with it for the rest of the year.
When Enter is pressed while the cursor is exactly on the current
indent width, remove the blank characters on that line to avoid
creating a line that consists only of trailing whitespace.
(When Enter is pressed somewhere in the middle of the blanks,
however, the whitespace is preserved.)
Suggested-by: Florian Zeitz <florob@babelmonkeys.de>
In do_int_spell_fix(), spell-checking text may change firstcolumn if
the next match is offscreen, and spell-checking text after that will
not change it back. In order to keep the viewport unchanged, we have
to save and restore not just edittop, but firstcolumn as well.
In do_justify(), justifying text may change firstcolumn if the paragraph
ends offscreen, and unjustifying the text again will not change it back.
In order to keep the viewport unchanged, we have to save and restore not
just edittop, but firstcolumn as well.
Since all lines can be partially scrolled off the screen now
(except for the top line of the edit window, which is forthcoming),
ensure_line_is_visible() is no longer needed.
The mark only needs to be off when calling replace_marked_buffer(),
because this indirectly calls ingraft_buffer(), which fiddles with
the end points if the mark is on.
Replace partitioning with calls to extract_buffer() and ingraft_buffer().
In addition to pasting the unjustified text back into the buffer at
current[current_x], ingraft_buffer() also deals with renumbering and
updating totsize, so do_justify() doesn't need to do those anymore
when unjustifying.
With read_file() revamped, it now uses partition_filestruct() indirectly
via ingraft_buffer(), so we can't use partition_filestruct() to replace
marked text in the alternate spell checker anymore without segfaulting.
Add the new function replace_marked_buffer() to accomplish this instead.
Based on replace_buffer(), it uses extract_buffer() to throw away the
marked un-spell-checked text, and then uses read_file() to insert the
spell-checked text at the position where the mark was.
Accordingly, remove unneeded partitioning and related stuff from
do_alt_speller(). Besides pasting the file into the buffer at
current[current_x], ingraft_buffer() also deals with renumbering,
updating totsize, and handling a magicline, so do_alt_speller()
doesn't need to do those anymore.
In this last loop of break_line(), the pointer 'line' is one step ahead
of the index 'lastblank'. So the loop should first add the length of
the preceding character to 'lastblank' before determining the length
of the current character (and using this to advance 'line').
(There is something wrong in the last loop: line is one character ahead
of lastblank, but the current character length is added to both of them.
It thus assumes that all blank characters are the same number of bytes.
For spaces and tabs this works fine. But for more exotic blanks...)
Also, rename a parameter to be less cryptic, and remove an entire
condition because the relevant block will never be reached when
getting called from the help routines: if blank_loc is negative,
the function will have bailed out in the preceding if.
When the marked region covers only a single line (or a part of it),
its new endpoint is not simply the length of the last line of the
spell-checked text, but instead the old endpoint plus the /change/
in length.
This fixes https://savannah.gnu.org/bugs/?50316.
Reported-by: David Lawrence Ramsey <pooka109@gmail.com>
If we're somewhere deep into the file and do a spell check, and the
first misspelled word happens to be right there, onscreen already,
then this word does not need to be centered -- it /should/ not be
centered. We should scroll only when necessary.
The spell fixer does not provide a beginning line, so the search routine
should then not try to refer to any data of this line. Also, since the
changes to the search routine there is no need any more to retreat one
step before starting to search for a misspelled word.
This fixes https://savannah.gnu.org/bugs/?50159.
That is: only extend the current Del or Backspace undo item when the
cursor is still (or again) at the same spot.
This fixes https://savannah.gnu.org/bugs/?50006.
Many of the adjustments of the value of openfile->current_y appear to be
a holdover from the days when certain functions had to account for what
is now called STATIONARY scrolling mode, which depends on the value of
current_y. Remove these adjustement where they are superfluous.
do_para_begin(), do_para_end(), and do_bracket_match() update the screen
through edit_redraw(), which uses either CENTERING or FLOWING scrolling
mode, so their setting of current_y is redundant and useless, as it will
be ignored and then overridden by the next call to reset_cursor().
findnextstr() is called by go_looking() [which calls edit_redraw(), see
above], and by do_replace_loop() and do_int_spell_fix(), which both call
edit_refresh(), which in this case only uses CENTERING scrolling mode
since focusing is TRUE.
(Additionally, the adjustments of current_y in findnextstr() and
do_bracket_match() use incorrect values when in softwrap mode.)
find_paragraph() doesn't need to save or restore current_y, because it
doesn't do any screen updates. do_justify() calls edit_refresh() with
focusing set to TRUE, so it uses the CENTERING scrolling mode.
do_alt_speller() and do_formatter() do not need to save and restore
current_y, because they don't modify it in any way.
This addresses https://savannah.gnu.org/patch/?9197.
After a call to the Formatter or the Alternate spell checker, the data
on the undo stack could refer to line positions that don't exist any
more -- the chance is small, but it is there. So... throw the whole
undo stack away, to prevent undoing things wrongly or even crashing.
(Changes made with the internal spell checker can be undone and redone
without a problem -- nano keeps full track of those. But the changes
made with a formatter or an external spell checker happen in another
process, so nano has no record of them.)
This fixes https://savannah.gnu.org/bugs/?49920.
When using an external spell checker or formatter, the line with
the cursor might become shorter, which might result in the stored
cursor position being beyond the end-of-line. So, when restoring
the x position, make sure to limit it to the length of the line.
This fixes https://savannah.gnu.org/bugs/?49923.