On some terminal emulators, Ctrl+Home and Ctrl+End produce special
keycodes, distinct from plain Home and End. Make the users of those
emulators (and of the Linux console) glad by making ^Home and ^End
do the obvious thing, and the combinations with Shift too.
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>
When a multi-column character straddles a chunk boundary, and the
preferred column (placewewant) for the cursor is zero, cheat: show
the cursor not where the character starts but on the beginning of
the next row. This makes the cursor move smoothly in the leftmost
column of the screen when using <Up> and <Down> and such, instead
of jumping around.
In this way the scrolling logic won't get confused and the screen
will scroll properly when stepping beyond the top or bottom row.
This fixes https://savannah.gnu.org/bugs/?50687.
When UTF-8 is available, use actual arrows instead of untranslated words
to indicate the cursor keys. This was already done for the combinations
with Ctrl but not yet for the plain cursor keys.
The unshifted shortcuts are easier to type, and also less confusing in
my eyes. Putting them first means they get shown in the help lines,
and get listed first in the ^G help text.
(I would also like to put ^- first instead of ^_ (because the latter
is hard to see when using the default inverse video for shortcuts),
but on several terminal emulators Ctrl+- reduces the font size.)
Use futimens() instead of utime() to change the timestamps on a backup
file. Otherwise, a non-privileged user could create an arbitrary symlink
with the name of the backup file and in this way fool a privileged user
to call utime() on the attacker-chosen file.
Import the relevant gnulib module to make sure futimens() is available.
If edittop is partially offscreen before we scroll, and it gets
scrolled more offscreen, we do need to compensate for the chunks
between firstcolumn and leftedge -- that is: the chunks between
the top row and the cursor row.
This fixes https://savannah.gnu.org/bugs/?50691.
When a two-column character cannot be shown because it straddles the
boundary between two chunks of a line, show the '>' placeholder for
its left "half", and '<' for its right "half".
This mitigates https://savannah.gnu.org/bugs/?49440.
The number of rows to draw shouldn't be compensated for the chunks
of edittop that are before firstcolumn, because they are offscreen.
This completes the fix for https://savannah.gnu.org/bugs/?50621.
There is no need to always increase nrows by 1 or 2 -- an increase
of 1 is only needed when the line that borders on the scrolled region
needs to redrawn too: when this line was horizontally scrolled or when
the mark is on.
This fixes https://savannah.gnu.org/bugs/?50621.
Reported-by: David Lawrence Ramsey <pooka109@gmail.com>
The complementary test on current_y should only be done when doing
a scroll-only, because only then the prior line can be offscreen.
This fixes https://savannah.gnu.org/bugs/?50658.
Reported-by: David Lawrence Ramsey <pooka109@gmail.com>
When scrolling backward, it is not just the bottom line of the screen
that doesn't need to be redrawn: also the line /before/ the top line
doesn't need a redraw. Mutatis mutandis for scrolling forward.
This fixes https://savannah.gnu.org/bugs/?50657.
When determining the leftedge of the current chunk, it is not simply
the leftedge that corresponds to the placewewant, but the leftedge that
corresponds to the minimum of the placewewant and the full line span.
This fixes https://savannah.gnu.org/bugs/?50653.
When typing PageUp or PageDOwn in non-smooth-scrolling mode, the cursor
should be placed at the start of the top line of the edit window. This
means that, when the line at edittop is partially scrolled offscreen,
the cursor should be placed at openfile->firstcolumn, not at zero.
This fixes https://savannah.gnu.org/bugs/?50645.
Reported-by: David Lawrence Ramsey <pooka109@gmail.com>
The "./" is a shorthand for "current working directory".
It is better to specify it, because it differs from what
Pico does: reading always from the user's home directory
no matter where the editor was started.
Only use the "from" thing when an operating directory is in effect,
because /only/ then the indicated directory can be something other
than "./".
Also, make it so that there is no space before the colon.
Put all the movement keys together, in order of ascending stride.
Also, move the Undo/Redo keystrokes further up, so that, when the
user has a somewhat wider terminal than the usual 80 characters,
these keystrokes will be shown -- they are far more interesting
than the ^Y and ^V ones, for which PgUp and PgDn can be used.
If the number of columns in the edit window changes (which currently
only happens in two places: in regenerate_screen(), called when the
window is resized; and in main(), when line numbering mode is toggled),
the display will break if we're in softwrap mode and firstcolumn is
nonzero. This is because the column width of softwrapped chunks has
changed, and firstcolumn is no longer the starting column of a chunk,
an assumption that all code using firstcolumn relies on.
To fix this problem, add a new function, ensure_firstcolumn_is_aligned(),
to adjust firstcolumn to the starting column of the chunk it's on, and
use it when the number of columns in the edit window changes.
(Note that this function uses the simplest possible fix, and could
probably be made more sophisticated.)
In do_replace(), replacing text may change firstcolumn if the next match
is offscreen, and replacing 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_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.