Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Commits on Dec 17, 2014
  1. @swilmet

    textview: add extend-selection signal

    swilmet authored
    To be able to customize the double-click and triple-click behaviors, to
    provide custom selection boundaries.
Commits on Oct 18, 2014
  1. @swilmet
  2. @swilmet

    docs: documentation for GtkTextBufferClass

    swilmet authored
    It'll most probably be more useful in the near future.
Commits on Sep 22, 2014
  1. @swilmet

    inspector: remove g_message()

    swilmet authored
    It was probably added for debugging purposes.
Commits on Sep 17, 2014
  1. @swilmet

    Better mark GtkAlignment as deprecated

    swilmet authored
    - Move the class to the Deprecated section.
    - Warning at the bottom of the class description.
    - A missing property was not marked as deprecated.
    - Update doc of gtk_container_set_border_width() to not mention
  2. @swilmet
Commits on Aug 25, 2014
  1. @swilmet

    inspector: fix a crash in the CSS editor

    swilmet authored
    gtk_css_section_get_end_position() can return a position one byte beyond
    the end of the last line.
    gtk_text_buffer_get_iter_at_line_index() accepts only valid
    line_number/byte_index pairs. Another solution is to make the
    GtkTextBuffer function less strict, by returning a boolean if the exact
    position was found.
    The CSS parser should also be fixed to always return valid positions.
    But it's better to have a safety net in the CSS editor, just in case (a
    warning could be print).
Commits on Aug 21, 2014
  1. @swilmet

    Simplify _gtk_text_buffer_get_line_log_attrs()

    swilmet authored
    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().
  2. @swilmet

    textbuffer: unit tests for the empty last line

    swilmet authored
    For functions using _gtk_text_buffer_get_line_log_attrs():
    - gtk_text_buffer_backspace()
    - some gtk_text_iter functions (word/sentence/cursor boundaries)
    As the FIXME comments show, there is a bug with
    gtk_text_iter_is_cursor_position() for an empty last line.
Commits on Aug 20, 2014
  1. @swilmet

    GtkTextView: various code clean-ups

    swilmet authored
    - 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.
  2. @swilmet
  3. @swilmet
Commits on Aug 16, 2014
  1. @swilmet

    Replace uses of g_memmove() by memmove()

    swilmet authored
    g_memmove() is deprecated, it is a simple macro that just calls
    memmove() with the same parameters.
    Reviewed by Paolo Borelli on IRC.
Commits on Jul 31, 2014
  1. @swilmet

    textiter: don't call g_utf8_prev_char() on start of string

    swilmet authored
    Changes also the "goto finally" with a break. A break is more common.
    Another way is to use g_utf8_find_prev_char().
Commits on Jul 29, 2014
  1. @swilmet

    textbuffer: emit notify signal for the "text" property

    swilmet authored
    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.
Commits on Jul 20, 2014
  1. @swilmet

    GtkTextView: use GSlice

    swilmet authored
    GSlice is better for allocating structs.
Commits on Jul 17, 2014
  1. @swilmet

    textiter: fix bug in find_visible_by_log_attrs()

    swilmet authored
    find_by_log_attrs() can return true only in this case:
    return moved && !gtk_text_iter_is_end (arg_iter);
    So if the iter moved (i.e. something has been found), but is the end
    iter, find_by_log_attrs() returns false.
    Now the same checks are made in find_visible_by_log_attrs(). The public
    functions using find_visible_by_log_attrs() say in their documentation
    that false is returned for the end iter, hence the check with
  2. @swilmet

    textiter: fix bug in FindLogAttrFunc functions

    swilmet authored
    attrs[len] is the last PangoLogAttr available, at the iter position after the
    last character of the line.
    For a line in the middle or the start of the buffer, the '\n' is taken
    into account by 'len'. For example the is_word_end is generally reached
    before the '\n', not after. But for the last line in the buffer, where
    there is no trailing '\n', it is important to test until attrs[len].
    The bug didn't occur before because find_by_log_attrs() worked directly
    on the iter passed as the function argument. But now it is no longer the
  3. @swilmet

    textiter: make the FindLogAttrFunc functions clearer

    swilmet authored
    - Return true (found) and false (not found) explicitly.
    - Set found_offset only when something has been found.
    find_backward_cursor_pos_func() was a bit different, the while loop had
    the condition "offset > 0" but the return was "offset >= 0". Probably a
    micro-optimization, since offset == 0 is always a cursor position.
    Anyway now the code is the same as the other functions.
  4. @swilmet

    textiter: simplify FindLogAttrFunc

    swilmet authored
    The min_offset parameter was always 0. Since there are some bugs in this
    code, it'll be clearer if there are fewer parameters.
  5. @swilmet

    textiter: fix bug in find_by_log_attrs()

    swilmet authored
    Do not work with the iter passed as the function argument. Work with
    another iter, and set it back to the function argument only if something
    has been found.
    This fixes a few unit tests. But there are regressions for a few others.
  6. @swilmet

    tests textiter: unit tests for sentence boundaries

    swilmet authored
    As the FIXME comment shows, there is a bug. It is the same bug as for
    the word boundaries.
  7. @swilmet

    tests textiter: unit tests for visible word boundaries

    swilmet authored
    As the FIXME comments show, there are several problems.
Commits on Jul 13, 2014
  1. @swilmet
  2. @swilmet

    textiter: small optimization for find_by_log_attrs()

    swilmet authored
    Use gtk_text_iter_set_line_offset (&tmp_iter, 0) instead of
    gtk_text_iter_get_line(). The difference should not be big. In the first
    case the line doesn't need to be traversed thanks to the offset 0. For
    get_line(), the btree must be traversed.
    A temporary iter is needed to not break the behavior. But the behavior
    is quite strange, the function works directly on the iter passed as an
    argument to the function, even if the function returns FALSE (not
    found). So maybe a later commit will fix this strange behavior.
  3. @swilmet

    textiter: remove recursivity of find_by_log_attrs()

    swilmet authored
    find_by_log_attrs() was a recursive function. It is replaced by an
    The already_moved_initially parameter was TRUE only for the recursive
    call, so the paramater is removed.
    There is also a small cleanup of the find_visible_by_log_attrs()
    (remove trailing spaces, fix indentation).
    There is still a part to optimize for a later commit.
Commits on Jul 3, 2014
  1. @swilmet

    docs: make GtkWidget:margin-start and margin-end clearer

    swilmet authored
    margin-start and margin-end have been added for RTL support, see:
    So those properties are used only for the horizontal direction: left or
    right, not top or bottom.
  2. @swilmet

    doc: trivial fix

    swilmet authored
Commits on May 12, 2014
  1. @swilmet

    gtk_text_buffer_create_tag(): returns NULL on failure

    swilmet authored
    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).
  2. @swilmet

    Add boolean return value for gtk_text_tag_table_add()

    swilmet authored
    The user doesn't need to check the return value, because if FALSE is
    returned it is a programmer error. But it permits a nicer behavior for
    gtk_text_buffer_create_tag() in case of failure.
Commits on Apr 13, 2014
  1. @swilmet

    GtkTextView: use GSlice to allocate GtkTextLineSegment's

    swilmet authored Matthias Clasen committed
    Use GSlice to allocate all types of segments:
    - char
    - toggle
    - mark
    - pixbuf
    - child widget
    Char segments are a bit more complicated because the length of the text
    is determined at run time and stored in the 'byte_count' field. If the
    text is long, GSlice will call the system malloc() anyway, so it's
    better to always use GSlice for GtkTextLineSegment.
    Toggle segments are also freed in gtktextbtree.c, hence the function
    _gtk_toggle_segment_free() (for a later commit it would be nice to
    rename those functions with the _gtk_text prefix).
  2. @swilmet

    textview: inline a function

    swilmet authored Matthias Clasen committed
    gtk_text_view_move_cursor_internal() was exactly the same as
    gtk_text_view_move_cursor(), and was called only in the latter function.
  3. @swilmet

    doc: improve documentation of gtk_text_iter_inside_word()

    swilmet authored Matthias Clasen committed
    There is a possible confusion with the sentence:
    "@iter is inside a natural-language word"
    The iter should be viewed here as the pointed character (i.e. on the
    right of the iter), not as a position between two characters.
    Instead of improving the documentation, another solution would have been
    to change the implementation so it is interpreted as an iter position
    inside a word, i.e. between two characters that are part of a
    natural-language word. But maybe some applications rely on the current
  4. @swilmet

    tests textiter: test word boundaries

    swilmet authored Matthias Clasen committed
    - As the tests show, some of the functions have a strange and
    inconsistent behavior for corner cases.
    - Rename test_full_buffer() -> test_search_full_buffer() because
    textiter.c is used for other GtkTextIter unit tests.
Commits on Apr 3, 2014
  1. @swilmet

    doc: fix gtk_window_destroy() -> gtk_widget_destroy()

    swilmet authored
    Reviewed-by: Emmanuele Bassi
Something went wrong with that request. Please try again.