aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--widgets/e-cell-text.c7
-rw-r--r--widgets/e-table/e-cell-text.c7
-rw-r--r--widgets/table/e-cell-text.c7
3 files changed, 6 insertions, 15 deletions
diff --git a/widgets/e-cell-text.c b/widgets/e-cell-text.c
index e496a50cb4..d9d8a568db 100644
--- a/widgets/e-cell-text.c
+++ b/widgets/e-cell-text.c
@@ -184,15 +184,12 @@ 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 *p, *text_wc;
- int text_wc_len;
+ GdkWChar *p, *text_wc = g_new (GdkWChar, strlen (text) + 1);
+ int text_wc_len = gdk_mbstowcs (text_wc, text, strlen (text));
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;
-
/*
* Paint
*/
diff --git a/widgets/e-table/e-cell-text.c b/widgets/e-table/e-cell-text.c
index e496a50cb4..d9d8a568db 100644
--- a/widgets/e-table/e-cell-text.c
+++ b/widgets/e-table/e-cell-text.c
@@ -184,15 +184,12 @@ 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 *p, *text_wc;
- int text_wc_len;
+ GdkWChar *p, *text_wc = g_new (GdkWChar, strlen (text) + 1);
+ int text_wc_len = gdk_mbstowcs (text_wc, text, strlen (text));
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;
-
/*
* Paint
*/
diff --git a/widgets/table/e-cell-text.c b/widgets/table/e-cell-text.c
index e496a50cb4..d9d8a568db 100644
--- a/widgets/table/e-cell-text.c
+++ b/widgets/table/e-cell-text.c
@@ -184,15 +184,12 @@ 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 *p, *text_wc;
- int text_wc_len;
+ GdkWChar *p, *text_wc = g_new (GdkWChar, strlen (text) + 1);
+ int text_wc_len = gdk_mbstowcs (text_wc, text, strlen (text));
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;
-
/*
* Paint
*/