r18348 - gnucash/trunk/src/register/register-gnome - Enhancement bug 589787 - Multi-line up/down scroll for register transaction Notes field text
Phil Longstaff
plongstaff at code.gnucash.org
Fri Sep 25 19:36:56 EDT 2009
Author: plongstaff
Date: 2009-09-25 19:36:56 -0400 (Fri, 25 Sep 2009)
New Revision: 18348
Trac: http://svn.gnucash.org/trac/changeset/18348
Modified:
gnucash/trunk/src/register/register-gnome/gnucash-item-edit.c
Log:
Enhancement bug 589787 - Multi-line up/down scroll for register transaction Notes field text
Patch by James Raehl
Modified: gnucash/trunk/src/register/register-gnome/gnucash-item-edit.c
===================================================================
--- gnucash/trunk/src/register/register-gnome/gnucash-item-edit.c 2009-09-25 19:43:22 UTC (rev 18347)
+++ gnucash/trunk/src/register/register-gnome/gnucash-item-edit.c 2009-09-25 23:36:56 UTC (rev 18348)
@@ -168,6 +168,8 @@
static void
gnc_item_edit_draw_info (GncItemEdit *item_edit, int x, int y, TextDrawInfo *info)
{
+ const char LINE_FEED = 0x0a;
+
SheetBlock *block;
SheetBlockStyle *style;
GtkEditable *editable;
@@ -178,7 +180,7 @@
int xd, yd, wd, hd, dx, dy;
int start_pos, end_pos;
- int toggle_space, cursor_pos, cursor_byte_pos;
+ int toggle_space, cursor_pos, cursor_byte_pos, pos, loc;
const gchar *text;
PangoRectangle strong_pos;
PangoAttribute *attr;
@@ -214,6 +216,21 @@
gtk_editable_get_selection_bounds (editable, &start_pos, &end_pos);
+ if (cursor_pos == cursor_byte_pos) {
+ /* display at character after LF before cursor_pos */
+ /* (but not for UTF-8, which is messier to implement) */
+ for (pos = 0, loc = 0; pos <= start_pos; pos++) {
+ if ((pos > 0) && (text[pos-1] == LINE_FEED)) {
+ loc = pos;
+ }
+ }
+ text += loc;
+ start_pos -= loc;
+ end_pos -= loc;
+ cursor_pos -= loc;
+ cursor_byte_pos = g_utf8_offset_to_pointer (text, cursor_pos) - text;
+ }
+
info->layout = gtk_widget_create_pango_layout (GTK_WIDGET (item_edit->sheet), text);
/* Selection */
More information about the gnucash-changes
mailing list