]> Pileus Git - ~andy/gtk/blobdiff - docs/reference/gtk/text_widget.sgml
Improve docs. (#62359)
[~andy/gtk] / docs / reference / gtk / text_widget.sgml
index 64168b0cf997f6222be22273ae492d5236c2b887..ca015bcd51fec1f8394499f3d0879090715a73d1 100644 (file)
@@ -95,19 +95,22 @@ appears by moving these marks around.
 <footnote>
 <para>
 If you want to place the cursor in response to a user action, be sure to use
-gtk_text_buffer_place_cursor(), which moves both at once without causing a
-temporary selection (moving one then the other temporarily selects the range in
-between the old and new positions).
+<function>gtk_text_buffer_place_cursor()</function>, which moves both at once 
+without causing a temporary selection (moving one then the other temporarily 
+selects the range in between the old and new positions).
 </para>
 </footnote>
 </para>
 
 <para>
-Text buffers always contain at least one line, but may be empty (that is,
-buffers can contain zero characters). The last line in the text buffer never
-ends in a line separator (such as newline); the other lines in the buffer always
-end in a line separator. Line separators count as characters when computing
-character counts and character offsets.
+Text buffers always contain at least one line, but may be empty (that
+is, buffers can contain zero characters). The last line in the text
+buffer never ends in a line separator (such as newline); the other
+lines in the buffer always end in a line separator. Line separators
+count as characters when computing character counts and character
+offsets. Note that some Unicode line separators are represented with 
+multiple bytes in UTF-8, and the two-character sequence "\r\n" is also
+considered a line separator.
 </para>
 
 </refsect1>
@@ -119,7 +122,7 @@ character counts and character offsets.
 <para>
 The simplest usage of <link linkend="GtkTextView">GtkTextView</link> 
 might look like this:
-<programlisting>
+<informalexample><programlisting>
   GtkWidget *view;
   GtkTextBuffer *buffer;
 
@@ -133,12 +136,12 @@ might look like this:
    * screen; when the user edits the text, signals on the buffer
    * will be emitted, such as "changed", "insert_text", and so on.
    */
-</programlisting>
+</programlisting></informalexample>
 In many cases it's also convenient to first create the buffer with
-gtk_text_buffer_new(), then create a widget for that buffer with
-gtk_text_view_new_with_buffer(). Or you can change the buffer the
-widget displays after the widget is created with
-gtk_text_view_set_buffer().
+<function>gtk_text_buffer_new()</function>, then create a widget for that 
+buffer with <function>gtk_text_view_new_with_buffer()</function>. Or you can 
+change the buffer the widget displays after the widget is created with
+<function>gtk_text_view_set_buffer()</function>.
 </para>
 
 </refsect1>
@@ -157,16 +160,17 @@ For text features that come from the theme &mdash; such as
 font and foreground color &mdash use standard 
 <link linkend="GtkWidget">GtkWidget</link>
 functions such as 
-<link linkend="gtk_widget_modify_font">gtk_widget_modify_font()</link>
+<link linkend="gtk-widget-modify-font">gtk_widget_modify_font()</link>
 or 
-<link linkend="gtk_widget_modify_fg">gtk_widget_modify_fg()</link>.
+<link linkend="gtk-widget-modify-fg">gtk_widget_modify_text()</link>.
 For other attributes there are dedicated methods on 
 <link linkend="GtkTextView">GtkTextView</link> such as 
-<link linkend="gtk_text_view_set_tabs">gtk_text_view_set_tabs()</link>.
+<link linkend="gtk-text-view-set-tabs">gtk_text_view_set_tabs()</link>.
 
-<programlisting>
+<informalexample><programlisting>
   GtkWidget *view;
   GtkTextBuffer *buffer;
+  GtkTextIter start, end;
   PangoFontDescription *font_desc;
   GdkColor color;
   GtkTextTag *tag;
@@ -183,8 +187,8 @@ For other attributes there are dedicated methods on
   pango_font_description_free (font_desc);
 
   /* Change default color throughout the widget */
-  gdk_color_parse ("green", &color);
-  gtk_widget_modify_fg (view, GTK_STATE_NORMAL, &color);
+  gdk_color_parse ("green", &amp;color);
+  gtk_widget_modify_text (view, GTK_STATE_NORMAL, &amp;color);
 
   /* Change left margin throughout the widget */
   gtk_text_view_set_left_margin (GTK_TEXT_VIEW (view), 30);
@@ -192,10 +196,10 @@ For other attributes there are dedicated methods on
   /* Use a tag to change the color for just one part of the widget */
   tag = gtk_text_buffer_create_tag (buffer, "blue_foreground",
                                    "foreground", "blue", NULL);  
-  gtk_text_buffer_get_iter_at_offset (buffer, &start, 7);
-  gtk_text_buffer_get_iter_at_offset (buffer, &end, 12);
-  gtk_text_buffer_apply_tag (buffer, tag, &start, &end);
-</programlisting>
+  gtk_text_buffer_get_iter_at_offset (buffer, &amp;start, 7);
+  gtk_text_buffer_get_iter_at_offset (buffer, &amp;end, 12);
+  gtk_text_buffer_apply_tag (buffer, tag, &amp;start, &amp;end);
+</programlisting></informalexample>
 
 </para>