Commit Graph

186 Commits

Author SHA1 Message Date
Sébastien Wilmet
706c8e9c8d Simplify _gtk_text_buffer_get_line_log_attrs()
NULL was returned in case of an empty last line. Every users needed to
special-case this. Now it will return the expected result: char_len of 0
with one PangoLogAttr.

In compute_log_attrs(), 'paragraph' will be the empty string "" with
'char_len' == 0.
pango_get_log_attrs() works fine with an empty string, it will return
one correct PangoLogAttr (because there is one text position for the
empty string).

It fixes the unit tests for gtk_text_iter_is_cursor_position().

https://bugzilla.gnome.org/show_bug.cgi?id=156164
2014-08-21 18:43:34 +02:00
Sébastien Wilmet
f39d211021 GtkTextView: various code clean-ups
- only one blank line is enough to separate code sections.
- the 'signals' variable was in the middle of function prototypes.
- compare pointers to NULL in some conditions ("if(blah) should be used
  only if blah is a boolean variable). It makes the code clearer.
- various other things.
2014-08-20 19:19:10 +02:00
Sébastien Wilmet
3f4b9d8164 Replace uses of g_memmove() by memmove()
g_memmove() is deprecated, it is a simple macro that just calls
memmove() with the same parameters.

Reviewed by Paolo Borelli on IRC.
2014-08-16 15:50:17 +02:00
Sébastien Wilmet
8ad9cf8b8c textbuffer: emit notify signal for the "text" property
Although there is the "changed" signal, it is more correct to notify the
"text" property too. It can be useful for a small text view, where the
text is saved e.g. to gsettings with a binding to the text property.

The "text" property includes only the text, not child widgets or images,
so the notify signal is sent too many times (also for child widgets and
images), but it's not a big problem.

https://bugzilla.gnome.org/show_bug.cgi?id=624791
2014-07-29 15:21:23 +02:00
Sébastien Wilmet
9527205291 GtkTextView: use GSlice
GSlice is better for allocating structs.

https://bugzilla.gnome.org/show_bug.cgi?id=733407
2014-07-20 12:26:01 +02:00
Carlos Garnacho
67efefde49 textbuffer: Do not unset selection if failing to update the primary selection
This is expected to happen on wayland and other platforms with no primary selection,
and just leads to the selected text being cleared after any attempt to change the
text selection itself through either mouse/keyboard.
2014-07-02 18:57:39 +02:00
Sébastien Wilmet
1e3af04dd9 gtk_text_buffer_create_tag(): returns NULL on failure
Returns NULL in case of a duplicated tag name in the tag table. It is
still a programmer error to duplicate a name, but if it happens the
behavior is a little nicer (and hopefully doesn't crash).

https://bugzilla.gnome.org/show_bug.cgi?id=614717
2014-05-12 19:10:30 +02:00
William Jon McCann
469d333aa2 docs: use Returns: consistently
Instead of Return value:
2014-02-19 18:56:05 -05:00
William Jon McCann
a4b5929e81 docs: use apostrophe in *'re 2014-02-07 13:37:09 -05:00
William Jon McCann
285d216d3e docs: use apostrophe in *'ll 2014-02-07 13:35:54 -05:00
William Jon McCann
e34bd4137d docs: use apostrophes in *n't 2014-02-07 13:32:47 -05:00
William Jon McCann
7a208fbbf3 docs: use proper apostrophe
https://wiki.gnome.org/Design/OS/Typography
2014-02-07 13:06:10 -05:00
William Jon McCann
0ce016650b docs: Use markup for links 2014-02-07 09:42:12 -05:00
William Jon McCann
2a45418b67 docs: use proper quotes 2014-02-05 15:08:42 -05:00
William Jon McCann
66071234f6 docs: list items require blank lines 2014-02-01 05:35:43 -05:00
William Jon McCann
2d003553e8 docs: don't use <emphasis>
It is a little heavy handed. The text can speak for itself.
2014-01-28 02:02:05 -05:00
Sébastien Wilmet
310179176c Improve doc of gtk_text_buffer_paste_clipboard()
It didn't explain the behavior when there is a non-empty buffer
selection.

https://bugzilla.gnome.org/show_bug.cgi?id=339539
2013-09-16 09:48:24 +02:00
Sébastien Wilmet
8e916815bb textbuffer: fix selection replacement when pasting
It is more logical to first delete the selection and then pasting the
text. When the selection and the text contain tags, the new behavior is
more natural.

A segfault in paste_from_buffer() is also avoided. The segfault occurs when
the text to paste is deleted because it is the selection.

https://bugzilla.gnome.org/show_bug.cgi?id=339539
2013-09-16 09:48:24 +02:00
Sébastien Wilmet
a78fc4a9c5 Doc: small fixes in GtkTextView
Move GtkWrapMode from GtkTextTag to the GtkTextView section. The wrap
mode property is in the text view.

Links to the "mark-set" and "mark-deleted" signals.

Add a precision about gtk_text_buffer_get_iter_at_line().

Fix typo in gtk_text_tag_set_priority().

https://bugzilla.gnome.org/show_bug.cgi?id=708076
2013-09-14 21:45:00 +02:00
Emmanuele Bassi
0899ef7cc9 gtk: Use new macros for defining private data
https://bugzilla.gnome.org/show_bug.cgi?id=702996
2013-07-09 09:30:02 +01:00
William Jon McCann
d7260d4ee9 Fix a couple documentation warnings 2013-06-25 19:05:32 -04:00
Sébastien Wilmet
6b50045f90 Doc: various small fixes
https://bugzilla.gnome.org/show_bug.cgi?id=700007
2013-05-12 18:09:28 +02:00
Sébastien Wilmet
66dfab0b0a Small API doc fixes
For gtk_text_iter_get_char(), due to the "Returns" at the beginning of
the description, the description was not visible. So the first sentence
has been reworded.
2013-03-16 22:18:50 +01:00
Alexander Larsson
2422c44f8e Add custom va_marshallers in some places
This is a slight performance optimization in the common case.
2012-03-05 12:39:09 +01:00
Javier Jardón
9d0febc9a6 Change FSF Address 2012-02-27 17:06:11 +00:00
Matthias Clasen
5ff8fe6971 Documentation fixes
Mostly making sure that return values and varargs don't loose
their docs.
2011-09-25 21:04:49 -04:00
Matthias Clasen
aa291863bb GtkTextBuffer: Add accessible api
These functions match closely to the AtkText interface;
they will be used in the GtkTextView accessible implementation.
Keep them private for now.
2011-07-05 16:08:53 -04:00
Javier Jardón
0553a5524d Move documentation to inline comments: GtkTextBuffer 2011-04-18 02:08:36 +01:00
Matthias Clasen
a603a2a2ba GtkTextBufferPrivate: Improve struct packing 2011-04-12 12:48:02 -04:00
Ignacio Casal Quinteiro
b7de18ab35 Remove gtk_paste_point_override mark if we don't insert any text.
This patch fixes bug #590459.
2011-01-28 13:26:00 +01:00
Pavel Holejsovsky
2f0d40335b [GI] Add missing (transfer) annotations 2011-01-20 13:57:18 +01:00
Javier Jardón
55016f72f2 gtktexttag: Move public members to private header
And fix gail to not poke at GtkTextTag internals
2011-01-03 15:05:46 -05:00
Javier Jardón
1ceddae7da gtk/gtktextbuffer: Use accessor functions to access GtkSelectionData 2010-12-15 23:58:15 +00:00
Ignacio Casal Quinteiro
d8d73163fd Normalize boolean. 2010-11-01 22:59:21 +01:00
Ignacio Casal Quinteiro
37dc91f012 Do not use gbooleans to save some bits. 2010-11-01 22:43:35 +01:00
Matthias Clasen
e0aa12eb0a Tons of transfer annotations 2010-09-21 00:18:11 -04:00
Tomeu Vizoso
24d8c776d4 The 'len' argument of gtk_text_buffer_insert and gtk_text_buffer_insert_at_cursor isn't really the length of the 'text' argument 2010-08-17 17:57:58 +02:00
Paolo Borelli
cffda84e93 Annotate GtkTextBuffer insert methods 2010-08-04 21:04:04 +02:00
Javier Jardón
0fd82767ff gtktextbuffer: Remove GET_PRIVATE macro
It's only needed one time and should not be used again in the code.
2010-07-19 15:01:02 +02:00
Ignacio Casal Quinteiro
a1be4eccb0 Move GtkTextBuffer sealed attributes to private struct. 2010-07-17 10:39:37 +02:00
Javier Jardón
0a07e9733b gtk/: fully remove gtkalias hacks
https://bugzilla.gnome.org/show_bug.cgi?id=623845
2010-07-10 02:51:26 +02:00
Ignacio Casal Quinteiro
f50d06baea Bind get_bounds and use out instead of out caller-allocates.
There is no need to use caller-allocates if the scanner already detects it.
2010-07-05 18:41:22 +02:00
Ignacio Casal Quinteiro
4601ad2352 Fix GtkTextBuffer annotations. 2010-06-26 20:47:42 +02:00
Paolo Borelli
cf14d4f368 Annotate the methods to get TextBuffer iters 2010-06-14 19:04:47 +02:00
Steve Frécinaux
046069d918 [gtktextbuffer] Annotate gtk_text_buffer_create_mark()
Add (transfer none) to the return value of gtk_text_buffer_create_mark(),
as the documentation clearly states the caller doesn't have ownership of
the returned value.
2010-06-08 00:00:28 +02:00
Michael Natterer
0a49865ec4 gtk: remove begin-user-action/end-user-action around copying
Copying to the clipboard is not a buffer mutation, so calling
gtk_text_buffer_begin_user_action() and _end_user_action() is only
confusing apps which connect to these signals in order to build undo
stacks or otherwise track buffer changes. Most likely, these apps
either didn't notice the bugus undo step or simply work around it.
2010-03-07 12:15:33 +01:00
Johan Dahlin
fe85272112 [annotations] Add allow-none
This commit was created using a script that searched for all docstrings
containing a parameter and the string 'or %NULL'.
Gdk backends and demos excluded as they are not part of a public API

https://bugzilla.gnome.org/show_bug.cgi?id=610474
2010-02-19 17:57:51 -02:00
Colin Walters
6529c07614 [introspection] Merge in Gtk-custom.c annotations
The Gtk-custom.c file in gir-repository contained a number of
introspection annotations.  Merge those into the GTK source files.

Some documentation was moved from the tmpl/ files to accomodate
the addition of annotations.
2009-12-16 17:22:01 -02:00
Paolo Borelli
0bb51bca9b Remove unneeded call of begin/end user action
delete_interactive already uses them so no need to wrap the call.
2009-08-31 21:47:49 +02:00
Paolo Borelli
2d8b8e054a buffer_backspace should delete \r\n in one go
Special case \r\n in gtk_text_buffer_backspace since \r should not be
reinserted even if we are deleting one char at a time. Also add
corresponding unit test. Fixes bug #544724.
2009-08-29 21:29:57 -04:00