mirror of
git://git.sv.gnu.org/nano.git
synced 2025-01-20 08:19:19 +03:00
moving: the current chunk cannot be beyond the last chunk of a line
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.
This commit is contained in:
parent
c277cd6e5b
commit
244a503ddc
14
src/move.c
14
src/move.c
@ -463,7 +463,12 @@ void do_up(bool scroll_only)
|
||||
|
||||
#ifndef NANO_TINY
|
||||
if (ISSET(SOFTWRAP)) {
|
||||
leftedge = (openfile->placewewant / editwincols) * editwincols;
|
||||
size_t realspan = strlenpt(openfile->current->data);
|
||||
|
||||
if (openfile->placewewant < realspan)
|
||||
realspan = openfile->placewewant;
|
||||
|
||||
leftedge = (realspan / editwincols) * editwincols;
|
||||
target_column = openfile->placewewant % editwincols;
|
||||
}
|
||||
#endif
|
||||
@ -514,7 +519,12 @@ void do_down(bool scroll_only)
|
||||
|
||||
#ifndef NANO_TINY
|
||||
if (ISSET(SOFTWRAP)) {
|
||||
leftedge = (openfile->placewewant / editwincols) * editwincols;
|
||||
size_t realspan = strlenpt(openfile->current->data);
|
||||
|
||||
if (openfile->placewewant < realspan)
|
||||
realspan = openfile->placewewant;
|
||||
|
||||
leftedge = (realspan / editwincols) * editwincols;
|
||||
target_column = openfile->placewewant % editwincols;
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user