in do_mouse(), avoid redundant screen updates by using edit_redraw()

instead of edit_refresh(), and remove now-erroneous code that disables
setting the mark while in view mode


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2928 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
David Lawrence Ramsey 2005-07-25 19:04:20 +00:00
parent 78a81b29b1
commit 3d5e94560d
2 changed files with 11 additions and 12 deletions

View File

@ -141,6 +141,10 @@ CVS code -
do_next_word() do_next_word()
- Rework to be more like do_prev_word(), to avoid a potential - Rework to be more like do_prev_word(), to avoid a potential
problem if we start at the end of a line. (DLR) problem if we start at the end of a line. (DLR)
do_mouse()
- Avoid redundant screen updates by using edit_redraw() instead
of edit_refresh(), and remove now-erroneous code that disables
setting the mark while in view mode. (DLR)
do_output() do_output()
- When adding a character, just add its length in bytes to - When adding a character, just add its length in bytes to
current_x instead of calling do_right(), and set placewewant current_x instead of calling do_right(), and set placewewant

View File

@ -1728,8 +1728,9 @@ bool do_mouse(void)
bool sameline; bool sameline;
/* Did they click on the line with the cursor? If they /* Did they click on the line with the cursor? If they
* clicked on the cursor, we set the mark. */ * clicked on the cursor, we set the mark. */
size_t xcur; const filestruct *current_save = openfile->current;
/* The character they clicked on. */ size_t current_x_save = openfile->current_x;
size_t pww_save = openfile->placewewant;
/* Subtract out the size of topwin. */ /* Subtract out the size of topwin. */
mouse_y -= 2 - no_more_space(); mouse_y -= 2 - no_more_space();
@ -1744,25 +1745,19 @@ bool do_mouse(void)
openfile->current->prev != NULL; openfile->current_y--) openfile->current->prev != NULL; openfile->current_y--)
openfile->current = openfile->current->prev; openfile->current = openfile->current->prev;
xcur = actual_x(openfile->current->data, openfile->current_x = actual_x(openfile->current->data,
get_page_start(xplustabs()) + mouse_x); get_page_start(xplustabs()) + mouse_x);
openfile->placewewant = xplustabs();
#ifndef NANO_SMALL #ifndef NANO_SMALL
/* Clicking where the cursor is toggles the mark, as does /* Clicking where the cursor is toggles the mark, as does
* clicking beyond the line length with the cursor at the * clicking beyond the line length with the cursor at the
* end of the line. */ * end of the line. */
if (sameline && xcur == openfile->current_x) { if (sameline && openfile->current_x == current_x_save)
if (ISSET(VIEW_MODE)) {
print_view_warning();
return retval;
}
do_mark(); do_mark();
}
#endif #endif
openfile->current_x = xcur; edit_redraw(current_save, pww_save);
openfile->placewewant = xplustabs();
edit_refresh();
} }
} }