Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package gtksourceview5 for openSUSE:Factory checked in at 2023-01-14 20:31:15 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/gtksourceview5 (Old) and /work/SRC/openSUSE:Factory/.gtksourceview5.new.32243 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "gtksourceview5" Sat Jan 14 20:31:15 2023 rev:7 rq:1058169 version:5.6.2 Changes: -------- --- /work/SRC/openSUSE:Factory/gtksourceview5/gtksourceview5.changes 2022-09-23 14:15:08.533969887 +0200 +++ /work/SRC/openSUSE:Factory/.gtksourceview5.new.32243/gtksourceview5.changes 2023-01-14 20:31:31.193142750 +0100 @@ -1,0 +2,30 @@ +Wed Jan 11 11:09:15 UTC 2023 - Bjørn Lie <bjorn....@gmail.com> + +- Update to version 5.6.2: + + Add styling for 'def:note' to Adwaita and Adwaita-dark + + Adwaita-dark.xml: soften match color a bit + + Adwaita.xml: + - add def:statement + - soften search highlight + + Docs: Fix RegexError reference + + completion: + - add note about what when is_trigger can activate + - fix typo in documentation + + completionlistbox: lock listmodel items during snapshot + + completionprovider: fix documentation for get_priority() + + docs: add note about library initialization + + glsl.lang: set no-spell-check on default context + + kate: use italic for def:emphasis + + listsnapshot: + - add snapshotting listmodel + - allow mismatched hold()/release() + + llvm.lang: Add missing 'sge' keyword + + map: defer adjustment changes to next frame + + regex: Fix incorrect bitflag operations + + snippets: fix GtkSourceView:enable-snippets use without + completion + + testsuite/regex: walk subject as utf8 unless G_REGEX_RAW + + testsuite: use G_REGEX_RAW with invalid UTF-8 + + vim: implement rudimentary search through previous commands + +------------------------------------------------------------------- Old: ---- gtksourceview-5.6.1.tar.xz New: ---- gtksourceview-5.6.2.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ gtksourceview5.spec ++++++ --- /var/tmp/diff_new_pack.3XGWT2/_old 2023-01-14 20:31:33.557156713 +0100 +++ /var/tmp/diff_new_pack.3XGWT2/_new 2023-01-14 20:31:33.565156761 +0100 @@ -1,7 +1,7 @@ # # spec file for package gtksourceview5 # -# Copyright (c) 2022 SUSE LLC +# Copyright (c) 2023 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,7 +18,7 @@ %define _name gtksourceview Name: gtksourceview5 -Version: 5.6.1 +Version: 5.6.2 Release: 0 Summary: GTK+ Source Editing Widget License: LGPL-2.1-or-later ++++++ gtksourceview-5.6.1.tar.xz -> gtksourceview-5.6.2.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gtksourceview-5.6.1/.gitlab-ci.yml new/gtksourceview-5.6.2/.gitlab-ci.yml --- old/gtksourceview-5.6.1/.gitlab-ci.yml 2022-09-22 09:50:00.000000000 +0200 +++ new/gtksourceview-5.6.2/.gitlab-ci.yml 2023-01-11 00:31:12.000000000 +0100 @@ -24,9 +24,9 @@ stage: docs needs: [] variables: - MESON_FLAGS: "-Dc_std=c11 -Dcpp_std=c++11 -Dwerror=true --buildtype=release -Dglib:tests=false -Dgtk:media-gstreamer=disabled -Dgtk:broadway-backend=false -Dgtk:demos=false -Dgtk:build-examples=false -Dgtk:build-tests=false -Dgtk:werror=false -Dlibsass:werror=false -Dsassc:werror=false -Dlibadwaita:werror=false" + MESON_FLAGS: "-Dc_std=c11 -Dcpp_std=c++11 -Dwerror=true --buildtype=release -Dglib:tests=false -Dgtk:media-gstreamer=disabled -Dgtk:broadway-backend=false -Dgtk:demos=false -Dgtk:build-examples=false -Dgtk:build-tests=false -Dgtk:werror=false -Dlibsass:werror=false -Dsassc:werror=false" script: - - sudo dnf -y install git libpng-devel libjpeg-turbo-devel expat-devel + - sudo dnf -y install git libpng-devel libjpeg-turbo-devel expat-devel gtk4-devel - mkdir -p pfx/ - meson ${MESON_FLAGS} --prefix=${PWD}/pfx -Dgtk_doc=true _build - ninja -C _build install diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gtksourceview-5.6.1/NEWS new/gtksourceview-5.6.2/NEWS --- old/gtksourceview-5.6.1/NEWS 2022-09-22 09:50:00.000000000 +0200 +++ new/gtksourceview-5.6.2/NEWS 2023-01-11 00:31:12.000000000 +0100 @@ -1,3 +1,31 @@ +News in 5.6.2, 2023-01-23 +------------------------- + +This release contains a number of quality of life fixes for users. +It is recommended that distributions update to this release. + + * Add styling for 'def:note' to Adwaita and Adwaita-dark + * Adwaita-dark.xml: soften match color a bit + * Adwaita.xml: add def:statement + * Adwaita.xml: soften search highlight + * Docs: Fix RegexError reference + * completion: add note about what when is_trigger can activate + * completion: fix typo in documentation + * completionlistbox: lock listmodel items during snapshot + * completionprovider: fix documentation for get_priority() + * docs: add note about library initialization + * glsl.lang: set no-spell-check on default context + * kate: use italic for def:emphasis + * listsnapshot: add snapshotting listmodel + * listsnapshot: allow mismatched hold()/release() + * llvm.lang: Add missing 'sge' keyword + * map: defer adjustment changes to next frame + * regex: Fix incorrect bitflag operations + * snippets: fix GtkSourceView:enable-snippets use without completion + * testsuite/regex: walk subject as utf8 unless G_REGEX_RAW + * testsuite: use G_REGEX_RAW with invalid UTF-8 + * vim: implement rudimentary search through previous commands + News in 5.6.1, 2022-09-22 ------------------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gtksourceview-5.6.1/data/language-specs/glsl.lang new/gtksourceview-5.6.2/data/language-specs/glsl.lang --- old/gtksourceview-5.6.1/data/language-specs/glsl.lang 2022-09-22 09:50:00.000000000 +0200 +++ new/gtksourceview-5.6.2/data/language-specs/glsl.lang 2023-01-11 00:31:12.000000000 +0100 @@ -456,7 +456,7 @@ <keyword>gl_Fog</keyword> </context> - <context id="glsl"> + <context id="glsl" class="no-spell-check"> <include> <context ref="def:c-like-comment"/> <context ref="def:c-like-comment-multiline"/> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gtksourceview-5.6.1/data/language-specs/llvm.lang new/gtksourceview-5.6.2/data/language-specs/llvm.lang --- old/gtksourceview-5.6.1/data/language-specs/llvm.lang 2022-09-22 09:50:00.000000000 +0200 +++ new/gtksourceview-5.6.2/data/language-specs/llvm.lang 2023-01-11 00:31:12.000000000 +0100 @@ -146,6 +146,7 @@ <keyword>ult</keyword> <keyword>ule</keyword> <keyword>sgt</keyword> + <keyword>sge</keyword> <keyword>slt</keyword> <keyword>sle</keyword> <!-- fcmp --> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gtksourceview-5.6.1/data/styles/Adwaita-dark.xml new/gtksourceview-5.6.2/data/styles/Adwaita-dark.xml --- old/gtksourceview-5.6.1/data/styles/Adwaita-dark.xml 2022-09-22 09:50:00.000000000 +0200 +++ new/gtksourceview-5.6.2/data/styles/Adwaita-dark.xml 2023-01-11 00:31:12.000000000 +0100 @@ -102,7 +102,7 @@ <style name="line-numbers" background="libadwaita-dark" foreground="dark_2"/> <style name="map-overlay" background="dark_1"/> <style name="right-margin" background="dark_1" foreground="dark_1"/> - <style name="search-match" background="yellow_4" foreground="dark_4"/> + <style name="search-match" background="#rgba(246,211,45,.5)" foreground="dark_5"/> <style name="text" background="libadwaita-dark" foreground="light_5"/> <!-- Defaults --> @@ -120,16 +120,17 @@ <style name="def:heading" foreground="teal_3" bold="true"/> <style name="def:identifier" foreground="chameleon_3"/> <style name="def:inline-code" foreground="violet_2"/> - <style name="def:keyword" foreground="orange_2" bold="true"/> <style name="def:link-destination" foreground="blue_2" italic="true" underline="low"/> <style name="def:link-text" foreground="red_2"/> <style name="def:list-marker" foreground="orange_4" bold="true"/> <style name="def:net-address" foreground="blue_2" underline="low"/> + <style name="def:note" foreground="dark_4" background="yellow_4" bold="true"/> <style name="def:number" foreground="violet_2"/> <style name="def:preformatted-section" foreground="violet_2"/> <style name="def:preprocessor" foreground="orange_4"/> <style name="def:shebang" foreground="light_7" bold="true"/> <style name="def:special-char" foreground="red_1" bold="false"/> + <style name="def:statement" foreground="orange_2" bold="true"/> <style name="def:string" foreground="teal_2"/> <style name="def:strong-emphasis" bold="true"/> <style name="def:type" foreground="teal_2" bold="true"/> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gtksourceview-5.6.1/data/styles/Adwaita.xml new/gtksourceview-5.6.2/data/styles/Adwaita.xml --- old/gtksourceview-5.6.1/data/styles/Adwaita.xml 2022-09-22 09:50:00.000000000 +0200 +++ new/gtksourceview-5.6.2/data/styles/Adwaita.xml 2023-01-11 00:31:12.000000000 +0100 @@ -100,7 +100,7 @@ <style name="line-numbers" background="light_2" foreground="light_6"/> <style name="map-overlay" background="dark_1"/> <style name="right-margin" background="dark_1" foreground="dark_1"/> - <style name="search-match" background="#FCF7B5" foreground="dark_4"/> + <style name="search-match" background="#rgba(252,247,181,.5)" foreground="dark_4"/> <style name="text" background="light_2" foreground="dark_3"/> <!-- Defaults --> @@ -117,16 +117,17 @@ <style name="def:heading" foreground="teal_5" bold="true"/> <style name="def:identifier" foreground="chameleon_3"/> <style name="def:inline-code" foreground="violet_4"/> - <style name="def:keyword" foreground="orange_5" bold="true"/> <style name="def:link-destination" foreground="blue_3" italic="true" underline="low"/> <style name="def:link-text" foreground="red_3"/> <style name="def:list-marker" foreground="orange_5" bold="true"/> <style name="def:net-address" foreground="blue_3" underline="low"/> + <style name="def:note" foreground="dark_4" background="#FCF7B5" bold="true"/> <style name="def:number" foreground="violet_4"/> <style name="def:preformatted-section" foreground="violet_4"/> <style name="def:preprocessor" foreground="orange_5"/> <style name="def:shebang" foreground="dark_1" bold="true"/> <style name="def:special-char" foreground="red_2" bold="false"/> + <style name="def:statement" foreground="orange_5" bold="true"/> <style name="def:string" foreground="teal_5"/> <style name="def:strong-emphasis" bold="true"/> <style name="def:type" foreground="teal_5" bold="true"/> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gtksourceview-5.6.1/data/styles/kate-dark.xml new/gtksourceview-5.6.2/data/styles/kate-dark.xml --- old/gtksourceview-5.6.1/data/styles/kate-dark.xml 2022-09-22 09:50:00.000000000 +0200 +++ new/gtksourceview-5.6.2/data/styles/kate-dark.xml 2023-01-11 00:31:12.000000000 +0100 @@ -100,8 +100,8 @@ <style name="def:operator" foreground="green"/> <!-- Markup --> - <style name="def:emphasis" bold="true"/> - <style name="def:strong-emphasis" bold="true"/> + <style name="def:emphasis" italic="true"/> + <style name="def:strong-emphasis" italic="true" bold="true"/> <style name="def:inline-code" foreground="dark-orange"/> <style name="def:insertion" underline="single"/> <style name="def:deletion" strikethrough="true"/> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gtksourceview-5.6.1/data/styles/kate.xml new/gtksourceview-5.6.2/data/styles/kate.xml --- old/gtksourceview-5.6.1/data/styles/kate.xml 2022-09-22 09:50:00.000000000 +0200 +++ new/gtksourceview-5.6.2/data/styles/kate.xml 2023-01-11 00:31:12.000000000 +0100 @@ -99,8 +99,8 @@ <style name="def:operator" foreground="magenta"/> <!-- Markup --> - <style name="def:emphasis" bold="true"/> - <style name="def:strong-emphasis" bold="true"/> + <style name="def:emphasis" italic="true"/> + <style name="def:strong-emphasis" italic="true" bold="true"/> <style name="def:inline-code" foreground="dark-blue"/> <style name="def:insertion" underline="single"/> <style name="def:deletion" strikethrough="true"/> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gtksourceview-5.6.1/docs/overview.md new/gtksourceview-5.6.2/docs/overview.md --- old/gtksourceview-5.6.1/docs/overview.md 2022-09-22 09:50:00.000000000 +0200 +++ new/gtksourceview-5.6.2/docs/overview.md 2023-01-11 00:31:12.000000000 +0100 @@ -22,3 +22,11 @@ ``` $ gcc hello.c `pkg-config --cflags --libs gtksourceview-5` -o hello ``` + +## Library Initialization + +Your application *MUST* initialize GtkSourceView from `main()`. +Call `gtk_source_init()` or it's variant within your programming language. +A great place to do this is right after calling `gtk_init()`. + +In language bindings, this function is often named similar to `GtkSource.init()`. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gtksourceview-5.6.1/gtksourceview/gtksourcecompletionprovider.c new/gtksourceview-5.6.2/gtksourceview/gtksourcecompletionprovider.c --- old/gtksourceview-5.6.1/gtksourceview/gtksourcecompletionprovider.c 2022-09-22 09:50:00.000000000 +0200 +++ new/gtksourceview-5.6.2/gtksourceview/gtksourcecompletionprovider.c 2023-01-11 00:31:12.000000000 +0100 @@ -155,7 +155,7 @@ * provider so that higher priority providers results are shown * above lower priority providers. * - * Lower value indicates higher priority. + * Higher value indicates higher priority. */ int gtk_source_completion_provider_get_priority (GtkSourceCompletionProvider *self, @@ -176,11 +176,15 @@ * @iter: a #GtkTextIter * @ch: a #gunichar of the character inserted * - * This function is used to determine of a character inserted into the text + * This function is used to determine if a character inserted into the text * editor should cause a new completion request to be triggered. * * An example would be period '.' which might indicate that the user wants * to complete method or field names of an object. + * + * This method will only trigger when text is inserted into the #GtkTextBuffer + * while the completion list is visible and a proposal is selected. Incremental + * key-presses (like shift, control, or alt) are not triggerable. */ gboolean gtk_source_completion_provider_is_trigger (GtkSourceCompletionProvider *self, @@ -313,7 +317,7 @@ * * This function requests that the #GtkSourceCompletionProvider prepares * @cell to display the contents of @proposal. - * + * * Based on @cells column type, you may want to display different information. * * This allows for columns of information among completion proposals @@ -371,7 +375,7 @@ * * Providers should return a list of alternates to @proposal or %NULL if * there are no alternates available. - * + * * This can be used by the completion view to allow the user to move laterally * through similar proposals, such as overrides of methods by the same name. * diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gtksourceview-5.6.1/gtksourceview/gtksourcemap.c new/gtksourceview-5.6.2/gtksourceview/gtksourcemap.c --- old/gtksourceview-5.6.1/gtksourceview/gtksourcemap.c 2022-09-22 09:50:00.000000000 +0200 +++ new/gtksourceview-5.6.2/gtksourceview/gtksourcemap.c 2023-01-11 00:31:12.000000000 +0100 @@ -202,6 +202,11 @@ /* Signals connected indirectly to the buffer */ gulong buffer_notify_style_scheme_handler; + /* Tick callback to queue work until the next frame to + * avoid doing changes during LAYOUT phase. + */ + guint update_id; + /* Denotes if we are in a grab from button press */ guint in_press : 1; @@ -519,6 +524,37 @@ } gtk_adjustment_set_value (child_vadj, new_value); + + gtk_widget_queue_allocate (GTK_WIDGET (map)); +} + +static gboolean +gtk_source_map_do_update (GtkWidget *widget, + GdkFrameClock *frame_clock, + gpointer user_data) +{ + GtkSourceMap *map = GTK_SOURCE_MAP (widget); + GtkSourceMapPrivate *priv = gtk_source_map_get_instance_private (map); + + priv->update_id = 0; + update_child_vadjustment (map); + return G_SOURCE_REMOVE; +} + +static void +gtk_source_map_queue_update (GtkSourceMap *map) +{ + GtkSourceMapPrivate *priv = gtk_source_map_get_instance_private (map); + + g_assert (GTK_SOURCE_IS_MAP (map)); + + if (priv->update_id == 0) + { + priv->update_id = + gtk_widget_add_tick_callback (GTK_WIDGET (map), + gtk_source_map_do_update, + NULL, NULL); + } } static void @@ -531,8 +567,7 @@ if (value != priv->last_vadj_value) { priv->last_vadj_value = value; - update_child_vadjustment (map); - gtk_widget_queue_allocate (GTK_WIDGET (map)); + gtk_source_map_queue_update (map); } } @@ -547,7 +582,7 @@ if (upper != priv->last_vadj_upper) { priv->last_vadj_upper = upper; - gtk_widget_queue_allocate (GTK_WIDGET (map)); + gtk_source_map_queue_update (map); } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gtksourceview-5.6.1/gtksourceview/gtksourcesearchcontext.c new/gtksourceview-5.6.2/gtksourceview/gtksourcesearchcontext.c --- old/gtksourceview-5.6.1/gtksourceview/gtksourcesearchcontext.c 2022-09-22 09:50:00.000000000 +0200 +++ new/gtksourceview-5.6.2/gtksourceview/gtksourcesearchcontext.c 2023-01-11 00:31:12.000000000 +0100 @@ -3029,7 +3029,7 @@ * [property@SearchSettings:search-text] breaks a rule, the error can be * retrieved with this function. * - * The error domain is [enum@GLib.RegexError]. + * The error domain is [error@GLib.RegexError]. * * Free the return value with [met...@glib.error.free]. * diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gtksourceview-5.6.1/gtksourceview/gtksourceview-snippets.c new/gtksourceview-5.6.2/gtksourceview/gtksourceview-snippets.c --- old/gtksourceview-5.6.1/gtksourceview/gtksourceview-snippets.c 2022-09-22 09:50:00.000000000 +0200 +++ new/gtksourceview-5.6.2/gtksourceview/gtksourceview-snippets.c 2023-01-11 00:31:12.000000000 +0100 @@ -568,7 +568,7 @@ * the view, such as with completion providers. */ - if (snippets->buffer == NULL || snippets->queue.length == 0) + if (snippets->buffer == NULL) { return GDK_EVENT_PROPAGATE; } @@ -637,7 +637,7 @@ } cleanup: - if (snippets->queue.length == 0) + if (ret != GDK_EVENT_PROPAGATE && snippets->queue.length == 0) { if (snippets->informative) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gtksourceview-5.6.1/gtksourceview/implregex.c new/gtksourceview-5.6.2/gtksourceview/implregex.c --- old/gtksourceview-5.6.1/gtksourceview/implregex.c 2022-09-22 09:50:00.000000000 +0200 +++ new/gtksourceview-5.6.2/gtksourceview/implregex.c 2023-01-11 00:31:12.000000000 +0100 @@ -99,12 +99,18 @@ if ((flags & G_REGEX_RAW) == 0) { ret |= (PCRE2_UTF | PCRE2_NO_UTF_CHECK); + } + else + { flags &= ~G_REGEX_RAW; } - if (~flags & G_REGEX_BSR_ANYCRLF) + if ((flags & G_REGEX_BSR_ANYCRLF) == 0) { ret |= PCRE2_BSR_UNICODE; + } + else + { flags &= ~G_REGEX_BSR_ANYCRLF; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gtksourceview-5.6.1/gtksourceview/vim/gtksourcevimcommandbar.c new/gtksourceview-5.6.2/gtksourceview/vim/gtksourcevimcommandbar.c --- old/gtksourceview-5.6.1/gtksourceview/vim/gtksourcevimcommandbar.c 2022-09-22 09:50:00.000000000 +0200 +++ new/gtksourceview-5.6.2/gtksourceview/vim/gtksourcevimcommandbar.c 2023-01-11 00:31:12.000000000 +0100 @@ -1,7 +1,7 @@ /* * This file is part of GtkSourceView * - * Copyright 2021 Christian Hergert <cherg...@redhat.com> + * Copyright 2021-2022 Christian Hergert <cherg...@redhat.com> * * GtkSourceView is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -32,6 +32,7 @@ GtkSourceVimState parent_instance; GtkSourceVimCommand *command; GString *buffer; + char *typed; int history_pos; }; @@ -58,6 +59,8 @@ { GtkSourceVimCommandBar *self = (GtkSourceVimCommandBar *)object; + g_clear_pointer (&self->typed, g_free); + if (self->buffer == NULL) { g_string_free (self->buffer, TRUE); @@ -86,23 +89,45 @@ move_history (GtkSourceVimCommandBar *self, int direction) { + int position; + g_assert (GTK_SOURCE_IS_VIM_COMMAND_BAR (self)); if (history->len == 0) + { return; + } + + if (self->typed == NULL && self->buffer->len > 0) + { + self->typed = g_strdup (self->buffer->str); + } - if (direction < 0) - self->history_pos--; - else - self->history_pos++; - - if (self->history_pos < 0) - self->history_pos = history->len - 1; - else if (self->history_pos >= history->len) - self->history_pos = 0; + direction = direction < 0 ? -1 : 1; + position = self->history_pos + direction; - g_string_truncate (self->buffer, 0); - g_string_append (self->buffer, g_ptr_array_index (history, self->history_pos)); + while (position >= 0 && position < history->len) + { + const char *item = g_ptr_array_index (history, position); + + if (self->typed == NULL || g_str_has_prefix (item, self->typed)) + { + self->history_pos = position; + g_string_truncate (self->buffer, 0); + g_string_append (self->buffer, item); + return; + } + + position += direction; + } + + /* Reset to typed text if we exhausted the tail of history */ + if (position >= history->len && self->typed != NULL) + { + self->history_pos = history->len; + g_string_truncate (self->buffer, 0); + g_string_append (self->buffer, self->typed); + } } static void @@ -191,6 +216,8 @@ { gsize len = g_utf8_strlen (self->buffer->str, -1); + g_clear_pointer (&self->typed, g_free); + if (len > 1) { char *s = g_utf8_offset_to_pointer (self->buffer->str, len-1); @@ -219,6 +246,7 @@ case GDK_KEY_Return: case GDK_KEY_KP_Enter: case GDK_KEY_ISO_Enter: + g_clear_pointer (&self->typed, g_free); do_execute (self, self->buffer->str); g_string_truncate (self->buffer, 0); do_notify (self); @@ -228,6 +256,7 @@ case GDK_KEY_u: if (mods & GDK_CONTROL_MASK) { + g_clear_pointer (&self->typed, g_free); g_string_truncate (self->buffer, 1); do_notify (self); return TRUE; @@ -242,6 +271,7 @@ if (str[0]) { g_string_append (self->buffer, str); + g_clear_pointer (&self->typed, g_free); do_notify (self); } @@ -256,7 +286,7 @@ g_assert (GTK_SOURCE_VIM_STATE (self)); - self->history_pos = 0; + self->history_pos = history->len; if (self->buffer->len == 0) { @@ -276,6 +306,9 @@ g_assert (GTK_SOURCE_VIM_STATE (self)); + self->history_pos = 0; + + g_clear_pointer (&self->typed, g_free); g_string_truncate (self->buffer, 0); do_notify (self); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gtksourceview-5.6.1/gtksourceview/vim/gtksourceviminsert.c new/gtksourceview-5.6.2/gtksourceview/vim/gtksourceviminsert.c --- old/gtksourceview-5.6.1/gtksourceview/vim/gtksourceviminsert.c 2022-09-22 09:50:00.000000000 +0200 +++ new/gtksourceview-5.6.2/gtksourceview/vim/gtksourceviminsert.c 2023-01-11 00:31:12.000000000 +0100 @@ -171,25 +171,38 @@ g_assert (GTK_SOURCE_IS_VIM_INSERT (self)); g_assert (event != NULL); - if (!(view = gtk_source_vim_state_get_view (state))) + view = gtk_source_vim_state_get_view (state); + + /* We only handle keypress, otherwise defer to the normal event processing + * flow and/or input methods. + */ + if (view == NULL || gdk_event_get_event_type (event) != GDK_KEY_PRESS) + { return FALSE; + } + /* gtk_text_view_im_context_filter_keypress() will always filter input that + * can be converted into an GtkIMContext::commit emission so we must check + * to see if any of our handlers will check first. + * + * This has a sort of annoying impact with the underlying input method that + * we could collide, but there doesn't seem to be much we can do about that. + * + * https://gitlab.gnome.org/GNOME/gtk/-/issues/5349 + */ keyval = gdk_key_event_get_keyval (event); keycode = gdk_key_event_get_keycode (event); mods = gdk_event_get_modifier_state (event) & gtk_accelerator_get_default_mod_mask (); - /* Allow input methods to complete */ - if (gtk_text_view_im_context_filter_keypress (GTK_TEXT_VIEW (view), event)) - return TRUE; + gtk_source_vim_state_keyval_to_string (keyval, mods, string); - /* Only deal with presses after this */ - if (gdk_event_get_event_type (event) != GDK_KEY_PRESS) + if (GTK_SOURCE_VIM_STATE_GET_CLASS (self)->handle_keypress (state, keyval, keycode, mods, string)) + { return TRUE; + } - gtk_source_vim_state_keyval_to_string (keyval, mods, string); - - return GTK_SOURCE_VIM_STATE_GET_CLASS (self)->handle_keypress (state, keyval, keycode, mods, string); + return FALSE; } static void diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gtksourceview-5.6.1/meson.build new/gtksourceview-5.6.2/meson.build --- old/gtksourceview-5.6.1/meson.build 2022-09-22 09:50:00.000000000 +0200 +++ new/gtksourceview-5.6.2/meson.build 2023-01-11 00:31:12.000000000 +0100 @@ -1,5 +1,5 @@ project('gtksourceview', 'c', - version: '5.6.1', + version: '5.6.2', license: 'LGPL-2.1-or-later', meson_version: '>= 0.60.0', default_options: [ 'c_std=gnu99', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gtksourceview-5.6.1/testsuite/test-regex.c new/gtksourceview-5.6.2/testsuite/test-regex.c --- old/gtksourceview-5.6.1/testsuite/test-regex.c 2022-09-22 09:50:00.000000000 +0200 +++ new/gtksourceview-5.6.2/testsuite/test-regex.c 2023-01-11 00:31:12.000000000 +0100 @@ -38,61 +38,61 @@ assert_iterations (GMatchInfo *mi1, ImplMatchInfo *mi2) { - gboolean r1; - gboolean r2; - gboolean next1; - gboolean next2; - GError *err1 = NULL; - GError *err2 = NULL; - - for (;;) - { - gboolean matches1 = g_match_info_matches (mi1); - gboolean matches2 = impl_match_info_matches (mi2); - int count1, count2; - - g_assert_cmpint (matches1, ==, matches2); - - if (!matches1) - break; - - count1 = g_match_info_get_match_count (mi1); - count2 = impl_match_info_get_match_count (mi2); - g_assert_cmpint (count1, ==, count2); - - /* Check past boundaries for correctness */ - for (int i = 0; i < count1 + 2; i++) - { - int p1_begin = -123, p2_begin = -123; - int p1_end = -123, p2_end = -123; - char *str1, *str2; - - r1 = g_match_info_fetch_pos (mi1, i, &p1_begin, &p1_end); - r2 = impl_match_info_fetch_pos (mi2, i, &p2_begin, &p2_end); - g_assert_cmpint (r1, ==, r2); - g_assert_cmpint (p1_begin, ==, p2_begin); - g_assert_cmpint (p1_end, ==, p2_end); - - str1 = g_match_info_fetch (mi1, i); - str2 = impl_match_info_fetch (mi2, i); - g_assert_cmpstr (str1, ==, str2); - - g_free (str1); - g_free (str2); - } - - g_assert_cmpint (g_match_info_is_partial_match (mi1), - ==, - impl_match_info_is_partial_match (mi2)); - - next1 = g_match_info_next (mi1, &err1); - next2 = impl_match_info_next (mi2, &err2); - g_assert_cmpint (next1, ==, next2); - g_assert_true (err1 == NULL || err2 != NULL); - } + gboolean r1; + gboolean r2; + gboolean next1; + gboolean next2; + GError *err1 = NULL; + GError *err2 = NULL; + + for (;;) + { + gboolean matches1 = g_match_info_matches (mi1); + gboolean matches2 = impl_match_info_matches (mi2); + int count1, count2; + + g_assert_cmpint (matches1, ==, matches2); + + if (!matches1) + break; + + count1 = g_match_info_get_match_count (mi1); + count2 = impl_match_info_get_match_count (mi2); + g_assert_cmpint (count1, ==, count2); + + /* Check past boundaries for correctness */ + for (int i = 0; i < count1 + 2; i++) + { + int p1_begin = -123, p2_begin = -123; + int p1_end = -123, p2_end = -123; + char *str1, *str2; + + r1 = g_match_info_fetch_pos (mi1, i, &p1_begin, &p1_end); + r2 = impl_match_info_fetch_pos (mi2, i, &p2_begin, &p2_end); + g_assert_cmpint (r1, ==, r2); + g_assert_cmpint (p1_begin, ==, p2_begin); + g_assert_cmpint (p1_end, ==, p2_end); + + str1 = g_match_info_fetch (mi1, i); + str2 = impl_match_info_fetch (mi2, i); + g_assert_cmpstr (str1, ==, str2); + + g_free (str1); + g_free (str2); + } + + g_assert_cmpint (g_match_info_is_partial_match (mi1), + ==, + impl_match_info_is_partial_match (mi2)); + + next1 = g_match_info_next (mi1, &err1); + next2 = impl_match_info_next (mi2, &err2); + g_assert_cmpint (next1, ==, next2); + g_assert_true (err1 == NULL || err2 != NULL); + } - g_assert_false (g_match_info_matches (mi1)); - g_assert_false (impl_match_info_matches (mi2)); + g_assert_false (g_match_info_matches (mi1)); + g_assert_false (impl_match_info_matches (mi2)); } static void @@ -101,138 +101,157 @@ GRegexCompileFlags compile_flags, GRegexMatchFlags match_flags) { - GError *err1 = NULL; - GError *err2 = NULL; - GRegex *reg1 = g_regex_new (pattern, compile_flags, 0, &err1); - /* Disable JIT for ImplRegex, as it is not as flexible for search */ - ImplRegex *reg2 = impl_regex_new (pattern, compile_flags & ~G_REGEX_OPTIMIZE, 0, &err2); - GMatchInfo *mi1 = NULL; - ImplMatchInfo *mi2 = NULL; - gboolean r1, r2; - int subject_len = strlen (subject); - - g_assert_true ((reg1 == NULL && reg2 == NULL) || - (reg1 != NULL && reg2 != NULL)); - g_assert_cmpstr (g_regex_get_pattern (reg1), - ==, - impl_regex_get_pattern (reg2)); - g_assert_cmpint (g_regex_get_max_lookbehind (reg1), - ==, - impl_regex_get_max_lookbehind (reg2)); - - r1 = g_regex_match (reg1, subject, match_flags, &mi1); - r2 = impl_regex_match (reg2, subject, match_flags, &mi2); - g_assert_cmpint (r1, ==, r2); - g_assert_true (err1 == NULL || err2 != NULL); - assert_iterations (mi1, mi2); - g_clear_pointer (&mi1, g_match_info_free); - g_clear_pointer (&mi2, impl_match_info_free); - - for (int i = 0; i <= subject_len; i++) - { - r1 = g_regex_match_full (reg1, subject, subject_len, i, match_flags, &mi1, &err1); - r2 = impl_regex_match_full (reg2, subject, subject_len, i, match_flags, &mi2, &err2); - g_assert_cmpint (r1, ==, r2); - g_assert_true (err1 == NULL || err2 != NULL); - assert_iterations (mi1, mi2); - g_clear_pointer (&mi1, g_match_info_free); - g_clear_pointer (&mi2, impl_match_info_free); - } + GError *err1 = NULL; + GError *err2 = NULL; + GRegex *reg1 = g_regex_new (pattern, compile_flags, 0, &err1); + /* Disable JIT for ImplRegex, as it is not as flexible for search */ + ImplRegex *reg2 = impl_regex_new (pattern, compile_flags & ~G_REGEX_OPTIMIZE, 0, &err2); + GMatchInfo *mi1 = NULL; + ImplMatchInfo *mi2 = NULL; + gboolean r1, r2; + int subject_len = strlen (subject); + + g_assert_true ((reg1 == NULL && reg2 == NULL) || + (reg1 != NULL && reg2 != NULL)); + g_assert_cmpstr (g_regex_get_pattern (reg1), + ==, + impl_regex_get_pattern (reg2)); + g_assert_cmpint (g_regex_get_max_lookbehind (reg1), + ==, + impl_regex_get_max_lookbehind (reg2)); + + r1 = g_regex_match (reg1, subject, match_flags, &mi1); + r2 = impl_regex_match (reg2, subject, match_flags, &mi2); + g_assert_cmpint (r1, ==, r2); + g_assert_true (err1 == NULL || err2 != NULL); + assert_iterations (mi1, mi2); + g_clear_pointer (&mi1, g_match_info_free); + g_clear_pointer (&mi2, impl_match_info_free); + + if (compile_flags & G_REGEX_RAW) + { + for (int i = 0; i <= subject_len; i++) + { + r1 = g_regex_match_full (reg1, subject, subject_len, i, match_flags, &mi1, &err1); + r2 = impl_regex_match_full (reg2, subject, subject_len, i, match_flags, &mi2, &err2); + g_assert_cmpint (r1, ==, r2); + g_assert_true (err1 == NULL || err2 != NULL); + assert_iterations (mi1, mi2); + g_clear_pointer (&mi1, g_match_info_free); + g_clear_pointer (&mi2, impl_match_info_free); + } + } + else + { + for (const char *iter = subject; *iter; iter = g_utf8_next_char (iter)) + { + gsize i = iter - subject; + r1 = g_regex_match_full (reg1, subject, subject_len, i, match_flags, &mi1, &err1); + r2 = impl_regex_match_full (reg2, subject, subject_len, i, match_flags, &mi2, &err2); + g_assert_cmpint (r1, ==, r2); + g_assert_true (err1 == NULL || err2 != NULL); + assert_iterations (mi1, mi2); + g_clear_pointer (&mi1, g_match_info_free); + g_clear_pointer (&mi2, impl_match_info_free); + } + } - g_clear_pointer (®1, g_regex_unref); - g_clear_pointer (®2, impl_regex_unref); + g_clear_pointer (®1, g_regex_unref); + g_clear_pointer (®2, impl_regex_unref); } static void test_compare (void) { - /* Flags match what we see from search context */ - GRegexCompileFlags compile = 0x2003; - GRegexMatchFlags match = 0x400; - - compare_impl_regex_to_g_regex ("aaa\n", "aa", compile, match); - compare_impl_regex_to_g_regex ("aaa\n", "aa", compile, match); - - compare_impl_regex_to_g_regex ("aaaa", "aa", compile, match); - compare_impl_regex_to_g_regex ("aaaa", "aa", compile, match); - - compare_impl_regex_to_g_regex ("aaaa\n", "aa", compile, match); - compare_impl_regex_to_g_regex ("aaaa\n", "aa", compile, match); - - compare_impl_regex_to_g_regex ("", "aa", compile, match); - compare_impl_regex_to_g_regex ("", "aa", compile, match); - - compare_impl_regex_to_g_regex ("hello\n", "\\w+", compile, match); - compare_impl_regex_to_g_regex ("hello\n", "\\w+", compile, match); - - compare_impl_regex_to_g_regex ("hello\nworld\n", "\\w+", compile, match); - compare_impl_regex_to_g_regex ("hello\nworld\n", "\\w+", compile, match); - - compare_impl_regex_to_g_regex ("hello\nworld\n", "(.*)*", compile, match); - compare_impl_regex_to_g_regex ("hello\nworld\n", "(.*)*", compile, match); - - compare_impl_regex_to_g_regex ("hello\nworld\n", "\\w+", compile, match); - compare_impl_regex_to_g_regex ("hello\nworld\n", "\\w+", compile, match); - - compare_impl_regex_to_g_regex ("hello\nworld\n", "\\w+", compile, match); - compare_impl_regex_to_g_regex ("hello\nworld\n", "\\w+", compile, match); - - compare_impl_regex_to_g_regex ("aa#bb", "(\\w+)#(\\w+)", compile, match); - compare_impl_regex_to_g_regex ("aa#bb", "(\\w+)#(\\w+)", compile, match); - - compare_impl_regex_to_g_regex ("aa#bb cc#dd", "(\\w+)#(\\w+)", compile, match); - compare_impl_regex_to_g_regex ("aa#bb cc#dd", "(\\w+)#(\\w+)", compile, match); - compare_impl_regex_to_g_regex ("aa#bb cc#dd", "(\\w+)#(\\w+)", compile, match); - - compare_impl_regex_to_g_regex ("hello\nworld\n", "(.*\n)*", compile, match); - compare_impl_regex_to_g_regex ("hello\nworld\n", "(.*\n)*", compile, match); - compare_impl_regex_to_g_regex ("hello\nworld\n", "(.*\n)*", compile, match); - compare_impl_regex_to_g_regex ("hello\nworld\n", "(.*\n)*", compile, match); - compare_impl_regex_to_g_regex ("hello\nworld\n", "(.*\\n)*", compile, match); - compare_impl_regex_to_g_regex ("hello\nworld\n", "(.*\\n)*", compile, match); - - compare_impl_regex_to_g_regex ("hello\nworld\n", "(.*\n)*", compile, match); - compare_impl_regex_to_g_regex ("hello\nworld\n", "(.*\\n)*", compile, match); - - compare_impl_regex_to_g_regex ("&aa", "\\baa\\b", compile, match); - compare_impl_regex_to_g_regex ("\342\200\223aa", "\\baa\\b", compile, match); - - compare_impl_regex_to_g_regex ("12\n", "(?<=1)23", compile, match); - compare_impl_regex_to_g_regex ("\n23\n", "(?<=1)23", compile, match); - compare_impl_regex_to_g_regex ("\n123\n", "(?<=1)23", compile, match); - compare_impl_regex_to_g_regex ("\n23\n", "(?<=1)23", compile, match); - compare_impl_regex_to_g_regex ("\n12", "(?<=1)23", compile, match); - compare_impl_regex_to_g_regex ("3", "(?<=1)23", compile, match); - compare_impl_regex_to_g_regex ("\n123 123\n", "(?<=1)23", compile, match); - - compare_impl_regex_to_g_regex ("12\n", "12(?=3)", compile, match); - compare_impl_regex_to_g_regex ("123\n", "12(?=3)", compile, match); - compare_impl_regex_to_g_regex ("\n123", "12(?=3)", compile, match); - compare_impl_regex_to_g_regex ("\n123 123\n", "12(?=3)", compile, match); + /* Flags match what we see from search context */ + GRegexCompileFlags compile = 0x2003; + GRegexMatchFlags match = 0x400; + + compare_impl_regex_to_g_regex ("aaa\n", "aa", compile, match); + compare_impl_regex_to_g_regex ("aaa\n", "aa", compile, match); + + compare_impl_regex_to_g_regex ("aaaa", "aa", compile, match); + compare_impl_regex_to_g_regex ("aaaa", "aa", compile, match); + + compare_impl_regex_to_g_regex ("aaaa\n", "aa", compile, match); + compare_impl_regex_to_g_regex ("aaaa\n", "aa", compile, match); + + compare_impl_regex_to_g_regex ("", "aa", compile, match); + compare_impl_regex_to_g_regex ("", "aa", compile, match); + + compare_impl_regex_to_g_regex ("hello\n", "\\w+", compile, match); + compare_impl_regex_to_g_regex ("hello\n", "\\w+", compile, match); + + compare_impl_regex_to_g_regex ("hello\nworld\n", "\\w+", compile, match); + compare_impl_regex_to_g_regex ("hello\nworld\n", "\\w+", compile, match); + + compare_impl_regex_to_g_regex ("hello\nworld\n", "(.*)*", compile, match); + compare_impl_regex_to_g_regex ("hello\nworld\n", "(.*)*", compile, match); + + compare_impl_regex_to_g_regex ("hello\nworld\n", "\\w+", compile, match); + compare_impl_regex_to_g_regex ("hello\nworld\n", "\\w+", compile, match); + + compare_impl_regex_to_g_regex ("hello\nworld\n", "\\w+", compile, match); + compare_impl_regex_to_g_regex ("hello\nworld\n", "\\w+", compile, match); + + compare_impl_regex_to_g_regex ("aa#bb", "(\\w+)#(\\w+)", compile, match); + compare_impl_regex_to_g_regex ("aa#bb", "(\\w+)#(\\w+)", compile, match); + + compare_impl_regex_to_g_regex ("aa#bb cc#dd", "(\\w+)#(\\w+)", compile, match); + compare_impl_regex_to_g_regex ("aa#bb cc#dd", "(\\w+)#(\\w+)", compile, match); + compare_impl_regex_to_g_regex ("aa#bb cc#dd", "(\\w+)#(\\w+)", compile, match); + + compare_impl_regex_to_g_regex ("hello\nworld\n", "(.*\n)*", compile, match); + compare_impl_regex_to_g_regex ("hello\nworld\n", "(.*\n)*", compile, match); + compare_impl_regex_to_g_regex ("hello\nworld\n", "(.*\n)*", compile, match); + compare_impl_regex_to_g_regex ("hello\nworld\n", "(.*\n)*", compile, match); + compare_impl_regex_to_g_regex ("hello\nworld\n", "(.*\\n)*", compile, match); + compare_impl_regex_to_g_regex ("hello\nworld\n", "(.*\\n)*", compile, match); + + compare_impl_regex_to_g_regex ("hello\nworld\n", "(.*\n)*", compile, match); + compare_impl_regex_to_g_regex ("hello\nworld\n", "(.*\\n)*", compile, match); + + compare_impl_regex_to_g_regex ("&aa", "\\baa\\b", compile, match); + compare_impl_regex_to_g_regex ("\342\200\223aa", "\\baa\\b", compile, match); + /* this can be a invalid UTF-8 string if substring-ed, make glib think it's a raw string */ + compare_impl_regex_to_g_regex ("\342\200\223aa", "\\baa\\b", compile | G_REGEX_RAW, match); + + compare_impl_regex_to_g_regex ("12\n", "(?<=1)23", compile, match); + compare_impl_regex_to_g_regex ("\n23\n", "(?<=1)23", compile, match); + compare_impl_regex_to_g_regex ("\n123\n", "(?<=1)23", compile, match); + compare_impl_regex_to_g_regex ("\n23\n", "(?<=1)23", compile, match); + compare_impl_regex_to_g_regex ("\n12", "(?<=1)23", compile, match); + compare_impl_regex_to_g_regex ("3", "(?<=1)23", compile, match); + compare_impl_regex_to_g_regex ("\n123 123\n", "(?<=1)23", compile, match); + + compare_impl_regex_to_g_regex ("12\n", "12(?=3)", compile, match); + compare_impl_regex_to_g_regex ("123\n", "12(?=3)", compile, match); + compare_impl_regex_to_g_regex ("\n123", "12(?=3)", compile, match); + compare_impl_regex_to_g_regex ("\n123 123\n", "12(?=3)", compile, match); } static void test_issue_198 (void) { - GError *error = NULL; - ImplRegex *re = impl_regex_new ("(a)*", 0, 0, &error); - ImplMatchInfo *mi = NULL; - char *aaa = g_malloc (8192); - gboolean r; - - g_assert_no_error (error); - g_assert_nonnull (re); - - memset (aaa, 'a', 8191); - aaa[8191] = 0; - r = impl_regex_match_full (re, aaa, 8191, 0, 0, &mi, &error); - g_assert_no_error (error); - g_assert_nonnull (mi); - g_assert_true (r); - - g_free (aaa); - g_clear_pointer (&mi, impl_match_info_free); - g_clear_pointer (&re, impl_regex_unref); + GError *error = NULL; + ImplRegex *re = impl_regex_new ("(a)*", 0, 0, &error); + ImplMatchInfo *mi = NULL; + char *aaa = g_malloc (8192); + gboolean r; + + g_assert_no_error (error); + g_assert_nonnull (re); + + memset (aaa, 'a', 8191); + aaa[8191] = 0; + r = impl_regex_match_full (re, aaa, 8191, 0, 0, &mi, &error); + g_assert_no_error (error); + g_assert_nonnull (mi); + g_assert_true (r); + + g_free (aaa); + g_clear_pointer (&mi, impl_match_info_free); + g_clear_pointer (&re, impl_regex_unref); } int