moving: limit the target column when it is beyond the last chunk
When the column given in gotoline() is beyond the last available column in the row of the last chunk, then set placewewant to the actual end of the chunk, to prevent surprising jumps to the left when moving up or down from there. This fixes https://savannah.gnu.org/bugs/?50995.master
parent
6971db773b
commit
08fd5b349b
|
@ -883,6 +883,12 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
|
|||
openfile->current_x = actual_x(openfile->current->data, column - 1);
|
||||
openfile->placewewant = column - 1;
|
||||
|
||||
#ifndef NANO_TINY
|
||||
if (ISSET(SOFTWRAP) && openfile->placewewant / editwincols >
|
||||
strlenpt(openfile->current->data) / editwincols)
|
||||
openfile->placewewant = strlenpt(openfile->current->data);
|
||||
#endif
|
||||
|
||||
/* When the position was manually given, center the target line. */
|
||||
if (interactive) {
|
||||
adjust_viewport(CENTERING);
|
||||
|
|
Loading…
Reference in New Issue