aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/table/e-cell-text.c
diff options
context:
space:
mode:
authorMiguel de Icaza <miguel@gnu.org>1999-12-02 02:28:27 +0800
committerArturo Espinosa <unammx@src.gnome.org>1999-12-02 02:28:27 +0800
commitf0da5ba3d04aa0c50d96d1002c22cde34909f00c (patch)
treec2063f4df9016c9ff6b70cdc1d4885db67df32f6 /widgets/table/e-cell-text.c
parent9c0f9f1264f8083d177a01bf01e75e8787d587ed (diff)
downloadgsoc2013-evolution-f0da5ba3d04aa0c50d96d1002c22cde34909f00c.tar.gz
gsoc2013-evolution-f0da5ba3d04aa0c50d96d1002c22cde34909f00c.tar.zst
gsoc2013-evolution-f0da5ba3d04aa0c50d96d1002c22cde34909f00c.zip
Keep track of the originally allocated piece of code.
1999-12-01 Miguel de Icaza <miguel@gnu.org> * e-cell-text.c (ect_draw): Keep track of the originally allocated piece of code. svn path=/trunk/; revision=1451
Diffstat (limited to 'widgets/table/e-cell-text.c')
-rw-r--r--widgets/table/e-cell-text.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/widgets/table/e-cell-text.c b/widgets/table/e-cell-text.c
index 78ba01e2ed..e496a50cb4 100644
--- a/widgets/table/e-cell-text.c
+++ b/widgets/table/e-cell-text.c
@@ -184,11 +184,13 @@ ect_draw (ECellView *ecell_view, GdkDrawable *drawable,
if (edit_display){
CellEdit *edit = text_view->edit;
const char *text = gtk_entry_get_text (edit->entry);
- GdkWChar *text_wc = g_new (GdkWChar, strlen (text) + 1);
- int text_wc_len = gdk_mbstowcs (text_wc, text, strlen (text));
+ GdkWChar *p, *text_wc;
+ int text_wc_len;
const int cursor_pos = GTK_EDITABLE (edit->entry)->current_pos;
const int left_len = gdk_text_width_wc (text_view->font, text_wc, cursor_pos);
+ text_wc = g_new (GdkWChar, strlen (text) + 1);
+ text_wc_len = gdk_mbstowcs (text_wc, text, strlen (text));
text_wc [text_wc_len] = 0;
/*
@@ -220,9 +222,9 @@ ect_draw (ECellView *ecell_view, GdkDrawable *drawable,
if ((px + left_len) > x2)
px -= left_len - (x2-x1);
- for (i = 0; *text_wc; text_wc++, i++){
+ for (i = 0, p = text_wc; *p; p++, i++){
gdk_draw_text_wc (
- drawable, font, gc, px, y, text_wc, 1);
+ drawable, font, gc, px, y, p, 1);
if (i == cursor_pos){
gdk_draw_line (
@@ -231,7 +233,7 @@ ect_draw (ECellView *ecell_view, GdkDrawable *drawable,
px, y + font->descent - 1);
}
- px += gdk_text_width_wc (font, text_wc, 1);
+ px += gdk_text_width_wc (font, p, 1);
}
if (i == cursor_pos){