aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'widgets')
-rw-r--r--widgets/ChangeLog3
-rw-r--r--widgets/e-cell-text.c12
-rw-r--r--widgets/e-table/ChangeLog3
-rw-r--r--widgets/e-table/e-cell-text.c12
-rw-r--r--widgets/table/e-cell-text.c12
5 files changed, 27 insertions, 15 deletions
diff --git a/widgets/ChangeLog b/widgets/ChangeLog
index 1317034e74..76e918b61d 100644
--- a/widgets/ChangeLog
+++ b/widgets/ChangeLog
@@ -1,5 +1,8 @@
1999-12-01 Miguel de Icaza <miguel@gnu.org>
+ * e-cell-text.c (ect_draw): Keep track of the originally allocated
+ piece of code.
+
* e-table-header-item.c (ethi_unrealize): Removed change cursor
from here.
diff --git a/widgets/e-cell-text.c b/widgets/e-cell-text.c
index 78ba01e2ed..e496a50cb4 100644
--- a/widgets/e-cell-text.c
+++ b/widgets/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){
diff --git a/widgets/e-table/ChangeLog b/widgets/e-table/ChangeLog
index 1317034e74..76e918b61d 100644
--- a/widgets/e-table/ChangeLog
+++ b/widgets/e-table/ChangeLog
@@ -1,5 +1,8 @@
1999-12-01 Miguel de Icaza <miguel@gnu.org>
+ * e-cell-text.c (ect_draw): Keep track of the originally allocated
+ piece of code.
+
* e-table-header-item.c (ethi_unrealize): Removed change cursor
from here.
diff --git a/widgets/e-table/e-cell-text.c b/widgets/e-table/e-cell-text.c
index 78ba01e2ed..e496a50cb4 100644
--- a/widgets/e-table/e-cell-text.c
+++ b/widgets/e-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){
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){