- nano.c:do_mouse() - Fix the mouse code to work with lines longer than COLS and with the proper positioning, including special characters (David Benbennick)
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1405 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
db28e96f2c
commit
e92a7bcb78
|
@ -32,11 +32,15 @@ CVS Code -
|
||||||
- nano.c:
|
- nano.c:
|
||||||
do_char()
|
do_char()
|
||||||
- Remove unneeded check_statblank() (David Benbennick).
|
- Remove unneeded check_statblank() (David Benbennick).
|
||||||
do_preserve_msg():
|
|
||||||
- Unsplit error message into a single fprintf call (Jordi).
|
|
||||||
do_int_spell_fix(), do_int_speller()
|
do_int_spell_fix(), do_int_speller()
|
||||||
- Fix crashes with mark position, current_x position,
|
- Fix crashes with mark position, current_x position,
|
||||||
and edit_update args (David Benbennick).
|
and edit_update args (David Benbennick).
|
||||||
|
do_mouse()
|
||||||
|
- Fix the mouse code to work with lines longer than COLS and
|
||||||
|
with the proper positioning, including special characters
|
||||||
|
(David Benbennick).
|
||||||
|
do_preserve_msg():
|
||||||
|
- Unsplit error message into a single fprintf call (Jordi).
|
||||||
main()
|
main()
|
||||||
- Call load_file with arg 0 for insert, as we aren't really
|
- Call load_file with arg 0 for insert, as we aren't really
|
||||||
doing an insert, allows new_file() to run if we open a
|
doing an insert, allows new_file() to run if we open a
|
||||||
|
|
55
nano.c
55
nano.c
|
@ -910,49 +910,40 @@ void do_mouse(void)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* If mouse not in edit or bottom window, return */
|
/* If mouse not in edit or bottom window, return */
|
||||||
if (wenclose(edit, mevent.y, mevent.x)) {
|
if (wenclose(edit, mevent.y, mevent.x) && currshortcut == main_list) {
|
||||||
|
int sameline;
|
||||||
/* Don't let people screw with the marker when they're in a
|
/* Did they click on the line with the cursor? If they
|
||||||
* subfunction. */
|
clicked on the cursor, we set the mark. */
|
||||||
if (currshortcut != main_list)
|
size_t xcur;
|
||||||
return;
|
/* The character they clicked on. */
|
||||||
|
|
||||||
/* Subtract out size of topwin. Perhaps we need a constant
|
/* Subtract out size of topwin. Perhaps we need a constant
|
||||||
* somewhere? */
|
* somewhere? */
|
||||||
mevent.y -= 2;
|
mevent.y -= 2;
|
||||||
|
|
||||||
/* Selecting where the cursor is sets the mark. Selecting
|
sameline = mevent.y == current_y;
|
||||||
* beyond the line length with the cursor at the end of the line
|
|
||||||
* sets the mark as well. */
|
/* Move to where the click occurred. */
|
||||||
if ((mevent.y == current_y) &&
|
for(; current_y < mevent.y && current->next != NULL; current_y++)
|
||||||
((mevent.x == current_x) || (current_x == strlen(current->data)
|
current = current->next;
|
||||||
&& (mevent.x >
|
for(; current_y > mevent.y && current->prev != NULL; current_y--)
|
||||||
strlen(current->data))))) {
|
current = current->prev;
|
||||||
|
|
||||||
|
xcur = actual_x(current, get_page_start(xplustabs()) + mevent.x);
|
||||||
|
|
||||||
|
/* Selecting where the cursor is toggles the mark. As does
|
||||||
|
selecting beyond the line length with the cursor at the end of
|
||||||
|
the line. */
|
||||||
|
if (sameline && xcur == current_x) {
|
||||||
if (ISSET(VIEW_MODE)) {
|
if (ISSET(VIEW_MODE)) {
|
||||||
print_view_warning();
|
print_view_warning();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
do_mark();
|
do_mark();
|
||||||
} else if (mevent.y > current_y) {
|
|
||||||
while (mevent.y > current_y) {
|
|
||||||
if (current->next != NULL)
|
|
||||||
current = current->next;
|
|
||||||
else
|
|
||||||
break;
|
|
||||||
current_y++;
|
|
||||||
}
|
}
|
||||||
} else if (mevent.y < current_y) {
|
|
||||||
while (mevent.y < current_y) {
|
current_x = xcur;
|
||||||
if (current->prev != NULL)
|
placewewant = xplustabs();
|
||||||
current = current->prev;
|
|
||||||
else
|
|
||||||
break;
|
|
||||||
current_y--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
current_x = actual_x(current, mevent.x);
|
|
||||||
placewewant = current_x;
|
|
||||||
update_cursor();
|
|
||||||
edit_refresh();
|
edit_refresh();
|
||||||
} else if (wenclose(bottomwin, mevent.y, mevent.x) && !ISSET(NO_HELP)) {
|
} else if (wenclose(bottomwin, mevent.y, mevent.x) && !ISSET(NO_HELP)) {
|
||||||
int i, k;
|
int i, k;
|
||||||
|
|
Loading…
Reference in New Issue