From b4219c2835c352e161ba2e4e1126d61fe4d1f39c Mon Sep 17 00:00:00 2001 From: Dave Peticolas Date: Wed, 7 Feb 2001 00:30:23 +0000 Subject: [PATCH] Fix cursor positioning bug. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@3608 57a11ea4-9604-0410-9ed3-97b8803252fd --- src/register/gnome/gnucash-item-edit.c | 14 ++++++++++---- src/register/gnome/gnucash-sheet.c | 6 +++--- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/register/gnome/gnucash-item-edit.c b/src/register/gnome/gnucash-item-edit.c index 467972a67f..cc242153f3 100644 --- a/src/register/gnome/gnucash-item-edit.c +++ b/src/register/gnome/gnucash-item-edit.c @@ -1,5 +1,5 @@ /********************************************************************\ - * gnucash-item-edit.c -- cell editor cut-npaste from gnumeric * + * gnucash-item-edit.c -- cell editor cut-n-paste from gnumeric * * * * This program is free software; you can redistribute it and/or * * modify it under the terms of the GNU General Public License as * @@ -23,6 +23,8 @@ /* * An editor for the gnucash sheet. * Cut and pasted from the gnumeric item-edit.c file. + * + * And then substantially rewritten by Dave Peticolas . */ @@ -220,7 +222,7 @@ item_edit_draw_info (ItemEdit *item_edit, int x, int y, TextDrawInfo *info) { case CELL_ALIGN_RIGHT: xoffset = info->text_rect.width - - (2*CELL_HPADDING + total_width); + (CELL_HPADDING + total_width); if (xoffset > 0) break; @@ -714,7 +716,8 @@ item_edit_set_cursor_pos (ItemEdit *item_edit, editable = GTK_EDITABLE (item_edit->editor); - if (changed_cells) { + if (changed_cells) + { CellAlignment align; align = gnc_table_get_align (table, item_edit->virt_loc); @@ -723,9 +726,12 @@ item_edit_set_cursor_pos (ItemEdit *item_edit, gtk_editable_set_position(editable, -1); else gtk_editable_set_position(editable, 0); + + if (item_edit->is_popup) + x -= item_edit->popup_toggle.toggle_offset; } - item_edit_draw_info(item_edit, o_x, o_y, &info); + item_edit_draw_info (item_edit, o_x, o_y, &info); if (info.text_1 == NULL) { diff --git a/src/register/gnome/gnucash-sheet.c b/src/register/gnome/gnucash-sheet.c index 8fbe780101..b4de9be61c 100644 --- a/src/register/gnome/gnucash-sheet.c +++ b/src/register/gnome/gnucash-sheet.c @@ -1248,14 +1248,14 @@ gnucash_button_press_event (GtkWidget *widget, GdkEventButton *event) GNC_TABLE_TRAVERSE_POINTER, &new_virt_loc); - gnucash_sheet_check_grab(sheet); + gnucash_sheet_check_grab (sheet); if (abort_move) return TRUE; - changed_cells = gnucash_sheet_cursor_move(sheet, new_virt_loc); + changed_cells = gnucash_sheet_cursor_move (sheet, new_virt_loc); - gnucash_sheet_check_grab(sheet); + gnucash_sheet_check_grab (sheet); gnucash_cursor_get_virt (GNUCASH_CURSOR(sheet->cursor), &new_virt_loc);