[gimp] app: remove member text_tool->preedit_len



commit a8548fa7fd85ebe90d2d2cb933200b1851cc2f63
Author: Michael Natterer <mitch gimp org>
Date:   Fri Feb 19 13:02:06 2010 +0100

    app: remove member text_tool->preedit_len
    
    because it is always strlen(text_tool->preedit_string)

 app/tools/gimptexttool-editor.c |    3 ---
 app/tools/gimptexttool.c        |    8 ++++----
 app/tools/gimptexttool.h        |    1 -
 3 files changed, 4 insertions(+), 8 deletions(-)
---
diff --git a/app/tools/gimptexttool-editor.c b/app/tools/gimptexttool-editor.c
index fe6b318..625418b 100644
--- a/app/tools/gimptexttool-editor.c
+++ b/app/tools/gimptexttool-editor.c
@@ -88,7 +88,6 @@ gimp_text_tool_editor_init (GimpTextTool *text_tool)
   text_tool->needs_im_reset = FALSE;
 
   text_tool->preedit_string = NULL;
-  text_tool->preedit_len    = 0;
   text_tool->preedit_cursor = 0;
   text_tool->overwrite_mode = FALSE;
   text_tool->x_pos          = -1;
@@ -856,8 +855,6 @@ gimp_text_tool_preedit_changed_cb (GtkIMContext *context,
                                      &text_tool->preedit_string, NULL,
                                      &text_tool->preedit_cursor);
 
-  text_tool->preedit_len = strlen (text_tool->preedit_string);
-
   /* FIXME: call gimp_text_tool_update_layout() here, and make sure
    * the preedit string is *only* honored for the display, and never
    * ends up on the text object
diff --git a/app/tools/gimptexttool.c b/app/tools/gimptexttool.c
index 44e894f..9d329c0 100644
--- a/app/tools/gimptexttool.c
+++ b/app/tools/gimptexttool.c
@@ -908,8 +908,8 @@ gimp_text_tool_draw (GimpDrawTool *draw_tool)
       cursor_index = strlen (string);
 
       /* TODO: make cursor position itself even inside preedits! */
-      if (text_tool->preedit_len > 0)
-        cursor_index += text_tool->preedit_len;
+      if (text_tool->preedit_string)
+        cursor_index += strlen (text_tool->preedit_string);
 
       g_free (string);
 
@@ -931,7 +931,7 @@ gimp_text_tool_draw (GimpDrawTool *draw_tool)
                                        overwrite_cursor,
                                        TRUE);
 
-      if (text_tool->preedit_string && text_tool->preedit_len > 0)
+      if (text_tool->preedit_string)
         gimp_text_tool_draw_preedit (draw_tool, logical_off_x, logical_off_y);
     }
 }
@@ -960,7 +960,7 @@ gimp_text_tool_draw_preedit (GimpDrawTool *draw_tool,
   min = strlen (string);
   g_free (string);
 
-  max = min + text_tool->preedit_len;
+  max = min + strlen (text_tool->preedit_string);
 
   layout = gimp_text_layout_get_pango_layout (text_tool->layout);
 
diff --git a/app/tools/gimptexttool.h b/app/tools/gimptexttool.h
index bd976b9..b7ea7d2 100644
--- a/app/tools/gimptexttool.h
+++ b/app/tools/gimptexttool.h
@@ -74,7 +74,6 @@ struct _GimpTextTool
   gboolean        needs_im_reset;
 
   gchar          *preedit_string;
-  gint            preedit_len;
   gint            preedit_cursor;
 
   gboolean        overwrite_mode;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]