The pointer not being NULL is enough indication that the mark is set.
Also, rename the pointer from 'mark_begin' to simply 'mark', since
the former is kind of pleonastic.
Because the highlighting hinders the display of affected lines,
and, more importantly, only the highlighted part would be written
if the file was modified and the user answers yes to the "Save?"
prompt.
This fixes https://savannah.gnu.org/bugs/?52474.
In the tiny version, do_prompt() will now have an extra NULL
parameter, which will cost maybe twenty extra bytes of code.
That is acceptable when it saves thirty lines in the source.
Before writing a file out, nano should check that the file on disk
hasn't been modified since it was read -- not only for the normal
"Write Out" action (^O), but also for "Save File" (future ^S) and
for "Save and Exit" (^X when --tempfile is used).
When writing fails and --tempfile is in effect, don't go on to prompt
for a file name; instead let the user decide what she wants to do.
This fixes https://savannah.gnu.org/bugs/?51040.
Signed-off-by: Viorel Bota <botaviorel@gmail.com>
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
The basic idea is that the cursor is always off, except when it needs
to be on: when waiting for text input, and in a few other cases: when
something was searched and found in the help viewer, and in the file
browser when option -g is in effect.
This fixes https://savannah.gnu.org/bugs/?51923.
Reported-by: Mike Frysinger <vapier@gentoo.org>
This is modeled after the comment/uncomment code. Each line's
individual indent is saved in the string array of the undo
group structure.
This fixes http://savannah.gnu.org/bugs/?46860.
The function does not contain any comment-specific code, so it can
be used to handle any kind of multiline undo item.
Also, extend the undo group structure to contain an array of strings,
one for each line in the group. When indent/unindent is hooked up to
the undo/redo code, this will allow the latter to restore the exact
original indents.
Also, remove an unneeded null_at() -- the null byte has been copied,
and reallocating the string would recover very little memory.
Also, call charmove() without using the & operator.
This is modeled after the undo/redo code for commenting. do_indent() now
calls indent_a_line() on each line it covers. The latter function will
eventually be used by the undo/redo code.
The preceding 'for' loop has already established that all the lines are
either unindentable or composed of only blanks. So if now a line cannot
be unindented, it means it is fully blank, so it can be simply skipped.
This fixes https://savannah.gnu.org/bugs/?51760.
Reported-by: David Lawrence Ramsey <pooka109@gmail.com>
Also, only unindent when all selected lines can be unindented,
which means that the relative indentation will be preserved.
For this purpose, it ignores empty lines and lines consisting
of only whitespace.
When unindenting is not possible, a message is shown.
This fixes https://savannah.gnu.org/bugs/?47684.
Instead of inserting the extra whitespace after the current indentation
of a line, add it to the start of the line. This causes a fixed amount
of visual whitespace to be added regardless of whether --tabstospaces
is used or not.
This fixes http://savannah.gnu.org/bugs/?51438,
and its ancestor https://savannah.gnu.org/bugs/?51408.
Assume that a linter line that contains an actual error message or
warning includes a colon followed by a space -- something that that
opening message from a modern gcc lacks.
Human column numbers are one-based, whereas x positions are zero-based.
Converting from the one to the other involves subtracting one. But when
the linter message does not provide a column number, the latter defaults
to zero. Catch that case and change the number to one.
This fixes https://savannah.gnu.org/bugs/?51550.
Commit 28beb3f added the 'forreal' parameter to prevent spotlight() from
placing the cursor wrongly due to an invalid placewewant. However, since
the variable-width softwrap overhaul (specifically, since commit 8490f4a),
place_the_cursor() no longer checks placewewant, so the parameter is no
longer needed.
Furthermore, dropping 'forreal' and thus always setting current_y won't
affect the operation of spotlight(), since the only functions that use
spotlight() (do_replace_loop() and do_int_spell_fix()) both call
edit_refresh() beforehand, which means that current_y will already
have been set to the value it will be set to again.
The help lines need to be redrawn one step after a justification
(whether it has been undone or not, to replace "Unjustify" with
"Uncut" again for ^U), and after switching buffers (to update a
possibly changed tag for ^T).
This fixes https://savannah.gnu.org/bugs/?51455.