weeding: remove another unnecessary setting of openfile->current_y
The setting of current_y in copy_from_filestruct() also appears to be a holdover from the days of a more-common STATIONARY scrolling mode. do_cut_text() uses the above function when copying text (uncutting text again right after cutting it). Since the text is effectively the same afterward, current_y doesn't need to change. do_uncut_text(), however, does need current_y up to date in one case: when uncutting a full screen or less' worth of lines, focusing will be FALSE, and it uses edit_refresh(), so it will use STATIONARY scrolling mode then. Take a cue from do_insertfile() and call reset_cursor() to get an updated current_y. (Note that the check for a full screen or less' worth of lines uses incorrect values when in softwrap mode, but that's a separate problem.) undo_cut(), do_redo(), and backup_lines() do not need set current_y because they all result in edit_refresh() with focusing = TRUE, so they do a CENTERING scroll which does not need current_y.
Этот коммит содержится в:
родитель
61bc248555
Коммит
d35ecd02b8
@ -284,6 +284,9 @@ void do_uncut_text(void)
|
||||
/* Mark the file as modified. */
|
||||
set_modified();
|
||||
|
||||
/* Update the cursor position to account for the inserted lines. */
|
||||
reset_cursor();
|
||||
|
||||
refresh_needed = TRUE;
|
||||
|
||||
#ifndef DISABLE_COLOR
|
||||
|
@ -469,11 +469,6 @@ void copy_from_filestruct(filestruct *somebuffer)
|
||||
/* Add the number of characters in the copied text to the file size. */
|
||||
openfile->totsize += get_totsize(openfile->fileage, openfile->filebot);
|
||||
|
||||
/* Update the current y-coordinate to account for the number of
|
||||
* lines the copied text has, less one since the first line will be
|
||||
* tacked onto the current line. */
|
||||
openfile->current_y += openfile->filebot->lineno - 1;
|
||||
|
||||
/* If we pasted onto the first line of the edit window, the corresponding
|
||||
* struct has been freed, so... point at the start of the copied text. */
|
||||
if (edittop_inside)
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user