Skip to content

Commit

Permalink
Bug 403979 - Balance column shows only low order digits when too narrow
Browse files Browse the repository at this point in the history
When the column/cell is too narrow to display all of the numbers it
will only display the low-order digits which can be confusing.

To over come this, when the column/cell is too narrow elipsize at
the end so you have a visual indication the cell is to narrow.
  • Loading branch information
Bob-IT committed Dec 1, 2022
1 parent 05ffd3d commit 0e565f4
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions gnucash/register/register-gnome/gnucash-sheet-private.c
Expand Up @@ -514,6 +514,26 @@ draw_cell (GnucashSheet *sheet, SheetBlock *block,
}
#endif

if ((text != NULL) && (*text != '\0') && g_strcmp0 (PRICE_CELL_TYPE_NAME,
gnc_table_get_cell_type_name (table, virt_loc)) == 0)
{
int text_width;
int text_border_padding;

pango_layout_get_pixel_size (layout, &text_width, NULL);

text_border_padding = gnc_item_edit_get_margin (item_edit, left_right) +
gnc_item_edit_get_padding_border (item_edit, left_right);

if (text_width + text_border_padding > width)
{
int pango_width = (width - text_border_padding) * PANGO_SCALE;

pango_layout_set_width (layout, pango_width); //pango units
pango_layout_set_ellipsize (layout, PANGO_ELLIPSIZE_END);
}
}

/* If this is the currently open transaction and
there is no text in this cell */
if ((table->current_cursor_loc.vcell_loc.virt_row ==
Expand Down

0 comments on commit 0e565f4

Please sign in to comment.