tweaks: move a setting, fix a type, and rearrange a line in do_mouse()

The value of sameline doesn't change, so it can be initialized to that.

Since i holds openfile->current_y, it should be ssize_t, not size_t.

And it's better to do the most significant part of a calculation first.
master
David Lawrence Ramsey 2017-01-02 13:31:42 -06:00 committed by Benno Schulenberg
parent fd0589d8bc
commit 1dd01eb4e1
1 changed files with 3 additions and 5 deletions

View File

@ -1738,7 +1738,7 @@ int do_mouse(void)
/* We can click on the edit window to move the cursor. */
if (wmouse_trafo(edit, &mouse_y, &mouse_x, FALSE)) {
bool sameline;
bool sameline = (mouse_y == openfile->current_y);
/* Did they click on the line with the cursor? If they
* clicked on the cursor, we set the mark. */
filestruct *current_save = openfile->current;
@ -1746,15 +1746,13 @@ int do_mouse(void)
size_t current_x_save = openfile->current_x;
#endif
sameline = (mouse_y == openfile->current_y);
#ifdef DEBUG
fprintf(stderr, "mouse_y = %d, current_y = %ld\n", mouse_y, (long)openfile->current_y);
#endif
#ifndef NANO_TINY
if (ISSET(SOFTWRAP)) {
size_t i = 0;
ssize_t i = 0;
openfile->current = openfile->edittop;
@ -1767,7 +1765,7 @@ int do_mouse(void)
if (i > mouse_y) {
openfile->current = openfile->current->prev;
openfile->current_x = actual_x(openfile->current->data,
mouse_x + (mouse_y - openfile->current_y) * editwincols);
((mouse_y - openfile->current_y) * editwincols) + mouse_x);
} else
openfile->current_x = actual_x(openfile->current->data, mouse_x);
} else