tweaks: rename two variables, and swap their declaration order
parent
cdc9a29598
commit
90ebff00ca
14
src/nano.c
14
src/nano.c
|
@ -1564,21 +1564,21 @@ void unbound_key(int code)
|
||||||
/* Handle a mouse click on the edit window or the shortcut list. */
|
/* Handle a mouse click on the edit window or the shortcut list. */
|
||||||
int do_mouse(void)
|
int do_mouse(void)
|
||||||
{
|
{
|
||||||
int mouse_col, mouse_row;
|
int click_row, click_col;
|
||||||
int retval = get_mouseinput(&mouse_col, &mouse_row, TRUE);
|
int retval = get_mouseinput(&click_col, &click_row, TRUE);
|
||||||
|
|
||||||
/* If the click is wrong or already handled, we're done. */
|
/* If the click is wrong or already handled, we're done. */
|
||||||
if (retval != 0)
|
if (retval != 0)
|
||||||
return retval;
|
return retval;
|
||||||
|
|
||||||
/* If the click was in the edit window, put the cursor in that spot. */
|
/* If the click was in the edit window, put the cursor in that spot. */
|
||||||
if (wmouse_trafo(edit, &mouse_row, &mouse_col, FALSE)) {
|
if (wmouse_trafo(edit, &click_row, &click_col, FALSE)) {
|
||||||
filestruct *current_save = openfile->current;
|
filestruct *current_save = openfile->current;
|
||||||
ssize_t row_count = mouse_row - openfile->current_y;
|
ssize_t row_count = click_row - openfile->current_y;
|
||||||
size_t leftedge;
|
size_t leftedge;
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
size_t current_x_save = openfile->current_x;
|
size_t current_x_save = openfile->current_x;
|
||||||
bool sameline = (mouse_row == openfile->current_y);
|
bool sameline = (click_row == openfile->current_y);
|
||||||
/* Whether the click was on the row where the cursor is. */
|
/* Whether the click was on the row where the cursor is. */
|
||||||
|
|
||||||
if (ISSET(SOFTWRAP))
|
if (ISSET(SOFTWRAP))
|
||||||
|
@ -1587,14 +1587,14 @@ int do_mouse(void)
|
||||||
#endif
|
#endif
|
||||||
leftedge = get_page_start(xplustabs());
|
leftedge = get_page_start(xplustabs());
|
||||||
|
|
||||||
/* Move current up or down to the row corresponding to mouse_row. */
|
/* Move current up or down to the row that was clicked on. */
|
||||||
if (row_count < 0)
|
if (row_count < 0)
|
||||||
go_back_chunks(-row_count, &openfile->current, &leftedge);
|
go_back_chunks(-row_count, &openfile->current, &leftedge);
|
||||||
else
|
else
|
||||||
go_forward_chunks(row_count, &openfile->current, &leftedge);
|
go_forward_chunks(row_count, &openfile->current, &leftedge);
|
||||||
|
|
||||||
openfile->current_x = actual_x(openfile->current->data,
|
openfile->current_x = actual_x(openfile->current->data,
|
||||||
actual_last_column(leftedge, mouse_col));
|
actual_last_column(leftedge, click_col));
|
||||||
|
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
/* Clicking where the cursor is toggles the mark, as does clicking
|
/* Clicking where the cursor is toggles the mark, as does clicking
|
||||||
|
|
10
src/prompt.c
10
src/prompt.c
|
@ -32,18 +32,18 @@ static size_t statusbar_x = HIGHEST_POSITIVE;
|
||||||
/* Handle a mouse click on the statusbar prompt or the shortcut list. */
|
/* Handle a mouse click on the statusbar prompt or the shortcut list. */
|
||||||
int do_statusbar_mouse(void)
|
int do_statusbar_mouse(void)
|
||||||
{
|
{
|
||||||
int mouse_x, mouse_y;
|
int click_row, click_col;
|
||||||
int retval = get_mouseinput(&mouse_x, &mouse_y, TRUE);
|
int retval = get_mouseinput(&click_col, &click_row, TRUE);
|
||||||
|
|
||||||
/* We can click on the statusbar window text to move the cursor. */
|
/* We can click on the statusbar window text to move the cursor. */
|
||||||
if (retval == 0 && wmouse_trafo(bottomwin, &mouse_y, &mouse_x, FALSE)) {
|
if (retval == 0 && wmouse_trafo(bottomwin, &click_row, &click_col, FALSE)) {
|
||||||
size_t start_col = strlenpt(prompt) + 2;
|
size_t start_col = strlenpt(prompt) + 2;
|
||||||
|
|
||||||
/* Move to where the click occurred. */
|
/* Move to where the click occurred. */
|
||||||
if (mouse_x >= start_col && mouse_y == 0) {
|
if (click_row == 0 && click_col >= start_col) {
|
||||||
statusbar_x = actual_x(answer,
|
statusbar_x = actual_x(answer,
|
||||||
get_statusbar_page_start(start_col, start_col +
|
get_statusbar_page_start(start_col, start_col +
|
||||||
statusbar_xplustabs()) + mouse_x - start_col);
|
statusbar_xplustabs()) + click_col - start_col);
|
||||||
update_the_statusbar();
|
update_the_statusbar();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue