* edit/edit.h (edit_move_to_prev_col): Declare the function to have

external linkage.
(edit_find_bracket): Likewise.
* edit/edit.c (edit_move_to_prev_col): Reflect the changes above.
(edit_find_bracket): Likewise.
* edit/editwidget.c (edit_event): When moving around with the mouse
use edit_move_down(), edit_move_up() and edit_move_to_prev_col()
instead of move_cursor() to update the cursor position since
the latter doesn't update some internal variables.
Use edit_find_bracket() to update the bracket pair highlighter
state.
This commit is contained in:
Pavel Tsekov 2006-12-10 22:07:28 +00:00
parent 498c6c0cf1
commit 2cb049a9cb
4 changed files with 25 additions and 23 deletions

View File

@ -1,3 +1,17 @@
2006-12-10 Pavel Tsekov <ptsekov@gmx.net>
* edit.h (edit_move_to_prev_col): Declare the function to have
external linkage.
(edit_find_bracket): Likewise.
* edit.c (edit_move_to_prev_col): Reflect the changes above.
(edit_find_bracket): Likewise.
* editwidget.c (edit_event): When moving around with the mouse
use edit_move_down(), edit_move_up() and edit_move_to_prev_col()
instead of move_cursor() to update the cursor position since
the latter doesn't update some internal variables.
Use edit_find_bracket() to update the bracket pair highlighter
state.
2006-12-04 Leonard den Ottolander <leonard den ottolander nl>
* editdraw.c (edit_draw_this_line): Remove unused variable book_mark.

View File

@ -100,7 +100,6 @@ char *option_backup_ext = NULL;
*/
static void edit_move_to_prev_col (WEdit *edit, long p);
static void user_menu (WEdit *edit);
int edit_get_byte (WEdit * edit, long byte_index)
@ -1354,7 +1353,7 @@ static int is_in_indent (WEdit *edit)
static int left_of_four_spaces (WEdit *edit);
static void
void
edit_move_to_prev_col (WEdit * edit, long p)
{
edit_cursor_move (edit, edit_move_forward3 (edit, p, edit->prev_col, 0) - edit->curs1);
@ -2075,7 +2074,7 @@ static long edit_get_bracket (WEdit * edit, int in_screen, unsigned long furthes
static long last_bracket = -1;
static void edit_find_bracket (WEdit * edit)
void edit_find_bracket (WEdit * edit)
{
edit->bracket = edit_get_bracket (edit, 1, 10000);
if (last_bracket != edit->bracket)

View File

@ -134,11 +134,13 @@ void edit_scroll_right (WEdit * edit, int i);
void edit_scroll_left (WEdit * edit, int i);
void edit_move_up (WEdit * edit, unsigned long i, int scroll);
void edit_move_down (WEdit * edit, int i, int scroll);
void edit_move_to_prev_col (WEdit *edit, long p);
int edit_get_col (WEdit * edit);
long edit_bol (WEdit * edit, long current);
long edit_eol (WEdit * edit, long current);
void edit_update_curs_row (WEdit * edit);
void edit_update_curs_col (WEdit * edit);
void edit_find_bracket (WEdit * edit);
void edit_block_copy_cmd (WEdit * edit);
void edit_block_move_cmd (WEdit * edit);

View File

@ -86,28 +86,14 @@ edit_event (WEdit * edit, Gpm_Event * event, int *result)
if (event->type & (GPM_DOWN | GPM_UP))
edit_push_key_press (edit);
edit_cursor_move (edit, edit_bol (edit, edit->curs1) - edit->curs1);
edit->prev_col = event->x - edit->start_col - 1;
if (--event->y > (edit->curs_row + 1))
edit_cursor_move (edit,
edit_move_forward (edit, edit->curs1,
event->y - (edit->curs_row +
1), 0)
- edit->curs1);
if (event->y < (edit->curs_row + 1))
edit_cursor_move (edit,
edit_move_backward (edit, edit->curs1,
(edit->curs_row + 1) -
event->y) - edit->curs1);
edit_cursor_move (edit,
(int) edit_move_forward3 (edit, edit->curs1,
event->x -
edit->start_col - 1,
0) - edit->curs1);
edit->prev_col = edit_get_col (edit);
edit_move_down (edit, event->y - (edit->curs_row + 1), 0);
else if (event->y < (edit->curs_row + 1))
edit_move_up (edit, (edit->curs_row + 1) - event->y, 0);
else
edit_move_to_prev_col (edit, edit_bol (edit, edit->curs1));
if (event->type & GPM_DOWN) {
edit_mark_cmd (edit, 1); /* reset */
@ -118,6 +104,7 @@ edit_event (WEdit * edit, Gpm_Event * event, int *result)
edit_mark_cmd (edit, 0);
update:
edit_find_bracket (edit);
edit->force |= REDRAW_COMPLETELY;
edit_update_curs_row (edit);
edit_update_curs_col (edit);