From 0e565f48d63a409f058634eef5bdd35caa1aff92 Mon Sep 17 00:00:00 2001 From: Robert Fewell <14uBobIT@gmail.com> Date: Fri, 25 Nov 2022 15:12:25 +0000 Subject: [PATCH] =?UTF-8?q?Bug=C2=A0403979=20-=20Balance=20column=20shows?= =?UTF-8?q?=20only=20low=20order=20digits=20when=20too=20narrow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- .../register-gnome/gnucash-sheet-private.c | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/gnucash/register/register-gnome/gnucash-sheet-private.c b/gnucash/register/register-gnome/gnucash-sheet-private.c index 07723e296e6..9db02586974 100644 --- a/gnucash/register/register-gnome/gnucash-sheet-private.c +++ b/gnucash/register/register-gnome/gnucash-sheet-private.c @@ -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 ==