Hello community,

here is the log from the commit of package libt3widget for openSUSE:Factory 
checked in at 2019-08-23 11:09:38
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/libt3widget (Old)
 and      /work/SRC/openSUSE:Factory/.libt3widget.new.7948 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "libt3widget"

Fri Aug 23 11:09:38 2019 rev:9 rq:725408 version:1.0.6

Changes:
--------
--- /work/SRC/openSUSE:Factory/libt3widget/libt3widget.changes  2019-01-08 
12:31:34.820069414 +0100
+++ /work/SRC/openSUSE:Factory/.libt3widget.new.7948/libt3widget.changes        
2019-08-23 11:09:42.354458664 +0200
@@ -1,0 +2,9 @@
+Thu Aug 22 19:45:18 UTC 2019 - Jan Engelhardt <[email protected]>
+
+- Update to new upstream release 1.0.6
+  * This release makes the indent_selection and
+    unindent_selection functions on edit_window_t behave exactly
+    as pressing tab or shift-tab. This resolves a segmentation
+    fault when calling these functions without a selected text.
+
+-------------------------------------------------------------------

Old:
----
  libt3widget-1.0.3.tar.bz2

New:
----
  libt3widget-1.0.6.tar.bz2

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ libt3widget.spec ++++++
--- /var/tmp/diff_new_pack.vx6jB3/_old  2019-08-23 11:09:42.910458596 +0200
+++ /var/tmp/diff_new_pack.vx6jB3/_new  2019-08-23 11:09:42.910458596 +0200
@@ -18,16 +18,15 @@
 
 Name:           libt3widget
 %define lname  libt3widget2
-Version:        1.0.3
+Version:        1.0.6
 Release:        0
 Summary:        The Tilde terminal dialog toolkit
 License:        GPL-3.0-only
 Group:          Development/Libraries/C and C++
-Url:            http://os.ghalkes.nl/t3/libt3widget.html
+Url:            https://os.ghalkes.nl/t3/libt3widget.html
 
 #Git-Clone:    git://github.com/gphalkes/t3widget
-Source:         http://os.ghalkes.nl/dist/%name-%version.tar.bz2
-BuildRoot:      %{_tmppath}/%{name}-%{version}-build
+Source:         https://os.ghalkes.nl/dist/%name-%version.tar.bz2
 BuildRequires:  c++_compiler
 BuildRequires:  fdupes
 BuildRequires:  gettext-tools
@@ -73,7 +72,7 @@
 applications that want to make use of libt3widget.
 
 %prep
-%setup -q
+%autosetup -p1
 
 %build
 %configure --docdir="%_docdir/%name"
@@ -88,12 +87,10 @@
 %postun -p /sbin/ldconfig -n %lname
 
 %files -n %lname
-%defattr(-,root,root)
 %_libdir/libt3widget.so.2*
-%doc COPYING
+%license COPYING
 
 %files devel
-%defattr(-,root,root)
 %_includedir/t3/
 %_libdir/libt3widget.so
 %_libdir/pkgconfig/libt3widget.pc

++++++ libt3widget-1.0.3.tar.bz2 -> libt3widget-1.0.6.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libt3widget-1.0.3/Changelog 
new/libt3widget-1.0.6/Changelog
--- old/libt3widget-1.0.3/Changelog     2018-12-31 10:55:12.000000000 +0100
+++ new/libt3widget-1.0.6/Changelog     2019-05-05 10:23:54.000000000 +0200
@@ -1,3 +1,19 @@
+Version 1.0.6:
+    Bug fixes
+    - Search & replace handles zero-width search results from regular 
expressions
+      allowing, for example, inserting a string at the start of the line by
+      replacing the pattern ^ by some text.
+    - Calling indent_selection and unindent_selection on an edit_window_t now
+      correctly performs the same action as pressing tab and shift-tab.
+
+Version 1.0.5:
+    Fix the configure script such that it attempts to compile all tests using 
the
+    correct CXXFLAGS.
+
+Version 1.0.4:
+    Introduce a PCRE2 compatibility layer using PCRE, to allow compilation on
+    platforms which don't provide PCRE2.
+
 Version 1.0.3:
     New features:
     - Migrate to using PCRE2 instead of PCRE.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libt3widget-1.0.3/Makefile.in 
new/libt3widget-1.0.6/Makefile.in
--- old/libt3widget-1.0.3/Makefile.in   2018-12-31 10:55:12.000000000 +0100
+++ new/libt3widget-1.0.6/Makefile.in   2019-05-05 10:23:54.000000000 +0200
@@ -66,7 +66,7 @@
 SILENTCXXLT=@echo '[CXXLT]' $< ;
 SILENTLDLT=@echo '[LDLT]' $@ ;
 
-OBJECTS=src/contentlist.lo src/widgets/split.lo src/colorscheme.lo 
src/widgets/bullet.lo src/main.lo src/dialogs/finddialog.lo src/undo.lo 
src/widgets/scrollbar.lo src/widgets/menuitem.lo src/dialogs/dialogbase.lo 
src/widgets/widgetgroup.lo src/widgets/multiwidget.lo src/textbuffer.lo 
src/dialogs/menupanel.lo src/widgets/expandergroup.lo src/widgets/button.lo 
src/widgets/textwindow.lo src/widgets/smartlabel.lo 
src/dialogs/attributepickerdialog.lo src/dialogs/dialog.lo 
src/dialogs/gotodialog.lo src/clipboard.lo src/dialogs/messagedialog.lo 
src/interfaces.lo src/log.lo src/modified_xxhash.lo 
src/dialogs/inputselectiondialog.lo src/wrapinfo.lo src/stringmatcher.lo 
src/dialogs/filedialog.lo src/widgets/label.lo src/string_view.lo 
src/widgets/colorpicker.lo src/widgets/editwindow.lo src/key_binding.lo 
src/widgets/expander.lo src/widgets/widget.lo src/key.lo src/textline.lo 
src/widgets/checkbox.lo src/widgets/listpane.lo src/widgets/menu.lo 
src/widgets/frame.lo src/autocompleter.lo src/widgets/separator.lo src/mouse.lo 
src/util.lo src/widgets/filepane.lo src/findcontext.lo src/widgets/textfield.lo 
src/dialogs/popup.lo src/dialogs/insertchardialog.lo src/dialogs/mainwindow.lo 
src/tinystring.lo
+OBJECTS=src/contentlist.lo src/widgets/split.lo src/colorscheme.lo 
src/widgets/bullet.lo src/main.lo src/dialogs/finddialog.lo src/undo.lo 
src/widgets/scrollbar.lo src/widgets/menuitem.lo src/dialogs/dialogbase.lo 
src/widgets/widgetgroup.lo src/widgets/multiwidget.lo src/textbuffer.lo 
src/dialogs/menupanel.lo src/widgets/button.lo src/widgets/textwindow.lo 
src/widgets/smartlabel.lo src/dialogs/attributepickerdialog.lo 
src/dialogs/dialog.lo src/dialogs/gotodialog.lo src/clipboard.lo 
src/dialogs/messagedialog.lo src/interfaces.lo src/log.lo src/pcre_compat.lo 
src/modified_xxhash.lo src/dialogs/inputselectiondialog.lo src/wrapinfo.lo 
src/stringmatcher.lo src/dialogs/filedialog.lo src/widgets/label.lo 
src/string_view.lo src/widgets/colorpicker.lo src/widgets/editwindow.lo 
src/key_binding.lo src/widgets/expander.lo src/widgets/widget.lo src/key.lo 
src/textline.lo src/widgets/checkbox.lo src/widgets/listpane.lo 
src/widgets/menu.lo src/widgets/frame.lo src/autocompleter.lo 
src/widgets/separator.lo src/mouse.lo src/util.lo src/widgets/filepane.lo 
src/findcontext.lo src/widgets/textfield.lo src/dialogs/popup.lo 
src/dialogs/insertchardialog.lo src/dialogs/mainwindow.lo src/tinystring.lo 
src/widgets/expandergroup.lo
 
 all: src/libt3widget.la $(X11MODULE)
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libt3widget-1.0.3/config.pkg 
new/libt3widget-1.0.6/config.pkg
--- old/libt3widget-1.0.3/config.pkg    2018-12-31 10:55:12.000000000 +0100
+++ new/libt3widget-1.0.6/config.pkg    2019-05-05 10:23:54.000000000 +0200
@@ -174,7 +174,21 @@
 }
 EOF
 
-       pkgconfig libpcre2-8 LIBPCRE test_link_cxx PKGCONFIG_REQUIRES_PRIVATE 
|| \
+       pkgconfig libpcre2-8 LIBPCRE test_link_cxx PKGCONFIG_REQUIRES_PRIVATE 
|| {
+               clean_c
+               cat > .configcxx.cc <<EOF
+#include <pcre.h>
+int main(int argc, char *argv[]) {
+       int err;
+       int err_offset;
+       const char *error_message;
+       pcre *pcre = pcre_compile2("pattern", PCRE_UTF8, &err, &error_message, 
&err_offset, NULL);
+       return 0;
+}
+EOF
+               pkgconfig libpcre LIBPCRE test_link PKGCONFIG_REQUIRES_PRIVATE 
&& \
+                       CONFIGFLAGS="${CONFIGFLAGS} -DPCRE_COMPAT"
+       } || \
                error "!! Can not find libpcre2-8. libpcre2-8 is required to 
compile libt3widget."
 
        if test_select "select in <sys/select.h>" "sys/select.h" ; then
@@ -391,7 +405,7 @@
        fi
 
        PKGCONFIG_DESC="Dialog toolkit library"
-       PKGCONFIG_VERSION="1.0.3"
+       PKGCONFIG_VERSION="1.0.6"
        PKGCONFIG_URL="http://os.ghalkes.nl/t3/libt3widget.html";
        PKGCONFIG_CFLAGS="-I\${includedir}/t3/widget"
        PKGCONFIG_LIBS="-lt3widget"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libt3widget-1.0.3/configure 
new/libt3widget-1.0.6/configure
--- old/libt3widget-1.0.3/configure     2018-12-31 10:55:12.000000000 +0100
+++ new/libt3widget-1.0.6/configure     2019-05-05 10:23:54.000000000 +0200
@@ -260,7 +260,7 @@
        check_message "Checking for $1... "
        shift
 
-       if test_make "$@" .configcxx.o >> config.log 2>&1 ; then
+       if test_make CXXFLAGS="$CXXFLAGS" "$@" .configcxx.o >> config.log 2>&1 
; then
                check_message_result "yes"
                true
        else
@@ -276,7 +276,7 @@
        check_message "Checking for $1... "
        shift
 
-       if test_make "$@" .configcxx >> config.log 2>&1 ; then
+       if test_make CXXFLAGS="$CXXFLAGS" "$@" .configcxx >> config.log 2>&1 ; 
then
                check_message_result "yes"
                true
        else
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libt3widget-1.0.3/src/findcontext.cc 
new/libt3widget-1.0.6/src/findcontext.cc
--- old/libt3widget-1.0.3/src/findcontext.cc    2018-12-31 10:55:12.000000000 
+0100
+++ new/libt3widget-1.0.6/src/findcontext.cc    2019-05-05 10:23:54.000000000 
+0200
@@ -17,7 +17,11 @@
 #include <cstdint>
 #include <cstring>
 #include <memory>
+#ifdef PCRE_COMPAT
+#include "t3widget/pcre_compat.h"
+#else
 #include <pcre2.h>
+#endif
 #include <string>
 #include <unicase.h>
 
@@ -330,7 +334,7 @@
     pcre_flags |= PCRE2_CASELESS;
   }
 
-  regex_.reset(pcre2_compile_8(reinterpret_cast<PCRE2_SPTR8>(pattern.data()), 
pattern.size(),
+  regex_.reset(pcre2_compile_8(reinterpret_cast<PCRE2_SPTR8>(pattern.c_str()), 
pattern.size(),
                                pcre_flags, &error_code, &error_offset, 
nullptr));
   if (regex_ == nullptr) {
     char buffer[256];
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libt3widget-1.0.3/src/main.h 
new/libt3widget-1.0.6/src/main.h
--- old/libt3widget-1.0.3/src/main.h    2018-12-31 10:55:12.000000000 +0100
+++ new/libt3widget-1.0.6/src/main.h    2019-05-05 10:23:54.000000000 +0200
@@ -34,7 +34,7 @@
     The value 0 is an invalid value which should be replaced by the script
     that builds the release package.
 */
-#define T3_WIDGET_VERSION 0x010003
+#define T3_WIDGET_VERSION 0x010006
 
 /** A class representing an error from one of the supporting libraries. */
 class T3_WIDGET_API complex_error_t {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libt3widget-1.0.3/src/pcre_compat.cc 
new/libt3widget-1.0.6/src/pcre_compat.cc
--- old/libt3widget-1.0.3/src/pcre_compat.cc    1970-01-01 01:00:00.000000000 
+0100
+++ new/libt3widget-1.0.6/src/pcre_compat.cc    2019-05-05 10:23:54.000000000 
+0200
@@ -0,0 +1,104 @@
+/* Copyright (C) 2019 G.P. Halkes
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License version 3, as
+   published by the Free Software Foundation.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "pcre_compat.h"
+
+#ifdef PCRE_COMPAT
+#include <string.h>
+
+static const char *last_error_message = NULL;
+static int last_error_code = 0;
+
+pcre2_code_8 *pcre2_compile_8(PCRE2_SPTR8 pattern, PCRE2_SIZE pattern_size, 
uint32_t options,
+                              int *errorcode, PCRE2_SIZE *erroroffset, void *) 
{
+  const char *error_message;
+  if (pattern_size != PCRE2_ZERO_TERMINATED && pattern[pattern_size] != 0) {
+    abort();
+  }
+  pcre2_code_8 *result = new pcre2_code_8;
+  result->regex = NULL;
+  result->extra = NULL;
+
+  result->regex = pcre_compile2(reinterpret_cast<const char *>(pattern), 
options, errorcode,
+                                &error_message, erroroffset, NULL);
+  if (result->regex == NULL) {
+    last_error_message = error_message;
+    last_error_code = *errorcode;
+    delete result;
+    return NULL;
+  }
+  return result;
+}
+
+int pcre2_jit_compile_8(pcre2_code_8 *code, uint32_t) {
+  const char *error_message;
+
+  code->extra = pcre_study(code->regex, 0, &error_message);
+  return 0;
+}
+
+pcre2_match_data_8 *pcre2_match_data_create_8(uint32_t ovecsize, void *) {
+  int *result;
+
+  if (ovecsize == 0) {
+    ++ovecsize;
+  }
+  result = new int[1 + 2 * ovecsize];
+  *result = 2 * ovecsize;
+  return result;
+}
+
+void pcre2_match_data_free_8(pcre2_match_data_8 *match_data) { delete[] 
match_data; }
+
+PCRE2_SIZE *pcre2_get_ovector_pointer_8(pcre2_match_data_8 *match_data) { 
return match_data + 1; }
+uint32_t pcre2_get_ovector_count_8(pcre2_match_data_8 *match_data) { return 
match_data[0] / 2; }
+
+pcre2_match_data_8 *pcre2_match_data_create_from_pattern_8(const pcre2_code_8 
*, void *) {
+  return pcre2_match_data_create_8(15, NULL);
+}
+
+void pcre2_code_free_8(pcre2_code_8 *code) {
+  if (code == NULL) {
+    return;
+  }
+  pcre_free(code->regex);
+  pcre_free_study(code->extra);
+  delete code;
+}
+
+int pcre2_match_8(const pcre2_code_8 *code, PCRE2_SPTR8 subject, PCRE2_SIZE 
length,
+                  PCRE2_SIZE startoffset, uint32_t options, pcre2_match_data_8 
*match_data,
+                  void *) {
+  return pcre_exec(
+      code->regex, code->extra, reinterpret_cast<const char *>(subject),
+      length == PCRE2_ZERO_TERMINATED ? strlen(reinterpret_cast<const char 
*>(subject)) : length,
+      startoffset, options, match_data + 1, *match_data);
+}
+
+int pcre2_get_error_message_8(int errorcode, PCRE2_UCHAR8 *buffer, PCRE2_SIZE 
bufflen) {
+  char *copy_end;
+  if (errorcode == last_error_code) {
+    copy_end = strncpy(reinterpret_cast<char *>(buffer), last_error_message, 
bufflen);
+  } else {
+    copy_end = strncpy(reinterpret_cast<char *>(buffer), "unknown error", 
bufflen);
+  }
+  buffer[bufflen - 1] = 0;
+  if (copy_end < reinterpret_cast<char *>(buffer) + bufflen) {
+    return copy_end - reinterpret_cast<char *>(buffer);
+  }
+  return PCRE2_ERROR_NOMEMORY;
+}
+#else
+int _t3_highlight_no_empty_translation_unit;
+#endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libt3widget-1.0.3/src/pcre_compat.h 
new/libt3widget-1.0.6/src/pcre_compat.h
--- old/libt3widget-1.0.3/src/pcre_compat.h     1970-01-01 01:00:00.000000000 
+0100
+++ new/libt3widget-1.0.6/src/pcre_compat.h     2019-05-05 10:23:54.000000000 
+0200
@@ -0,0 +1,88 @@
+/* Copyright (C) 2019 G.P. Halkes
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License version 3, as
+   published by the Free Software Foundation.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+/* This file contains a partial implementation of the PCRE2 API using the PCRE 
API. Note that a few
+   short-cuts have been taken to allow this to work. For example, the general 
context has been
+   replaced by void* because it is not used anywhere. */
+
+#ifndef PCRE_COMPAT_H
+#define PCRE_COMPAT_H
+
+#include <t3widget/widget_api.h>
+
+#ifdef PCRE_COMPAT
+
+#include <pcre.h>
+#include <stdint.h>
+
+/* Although PCRE2_SIZE is size_t, in the PCRE API it is int. */
+#define PCRE2_SIZE int
+#define PCRE2_SPTR8 const unsigned char *
+#define PCRE2_ZERO_TERMINATED ((PCRE2_SIZE)-1)
+#define PCRE2_UTF PCRE_UTF8
+#define PCRE2_ERROR_NOMEMORY PCRE_ERROR_NOMEMORY
+#define PCRE2_UCHAR8 unsigned char
+#define PCRE2_JIT_COMPLETE 1
+
+#define PCRE2_NO_UTF_CHECK PCRE_NO_UTF8_CHECK
+#define PCRE2_CASELESS PCRE_CASELESS
+#define PCRE2_NOTEOL PCRE_NOTEOL
+#define PCRE2_NOTBOL PCRE_NOTBOL
+
+#define PCRE2_ERROR_BADOPTION PCRE_ERROR_BADOPTION
+
+typedef struct {
+  pcre *regex;
+  pcre_extra *extra;
+} pcre2_code_8;
+
+typedef int pcre2_match_data_8;
+
+/* Redefine the symbol names to prevent potential symbol clashes with the 
actual pcre2 library. */
+#define pcre2_compile_8 t3_widget_pcre2_compile
+#define pcre2_pattern_info_8 t3_widget_pcre2_pattern_info
+#define pcre2_jit_compile_8 t3_widget_pcre2_jit_compile
+#define pcre2_match_data_create_8 t3_widget_pcre2_match_data_create
+#define pcre2_match_data_free_8 t3_widget_pcre2_match_data_free
+#define pcre2_match_data_create_from_pattern_8 
t3_widget_pcre2_match_data_create_from_pattern
+#define pcre2_code_free_8 t3_widget_pcre2_code_free
+#define pcre2_get_ovector_pointer_8 t3_widget_pcre2_get_ovector_pointer
+#define pcre2_get_ovector_count_8 t3_widget_pcre2_get_ovector_count
+#define pcre2_match_8 t3_widget_pcre2_match
+#define pcre2_get_error_message_8 t3_widget_pcre2_get_error_message
+#define pcre2_substring_number_from_name_8 
t3_widget_pcre2_substring_number_from_name
+
+T3_WIDGET_LOCAL pcre2_code_8 *pcre2_compile_8(PCRE2_SPTR8 pattern, PCRE2_SIZE 
pattern_size,
+                                              uint32_t options, int *errorcode,
+                                              PCRE2_SIZE *erroroffset, void 
*ccontext);
+
+T3_WIDGET_LOCAL int pcre2_jit_compile_8(pcre2_code_8 *code, uint32_t options);
+T3_WIDGET_LOCAL pcre2_match_data_8 *pcre2_match_data_create_8(uint32_t 
ovecsize, void *gcontext);
+T3_WIDGET_LOCAL void pcre2_match_data_free_8(pcre2_match_data_8 *match_data);
+T3_WIDGET_LOCAL pcre2_match_data_8 
*pcre2_match_data_create_from_pattern_8(const pcre2_code_8 *code,
+                                                                           
void *gcontext);
+T3_WIDGET_LOCAL PCRE2_SIZE *pcre2_get_ovector_pointer_8(pcre2_match_data_8 
*match_data);
+T3_WIDGET_LOCAL uint32_t pcre2_get_ovector_count_8(pcre2_match_data_8 
*match_data);
+T3_WIDGET_LOCAL void pcre2_code_free_8(pcre2_code_8 *code);
+T3_WIDGET_LOCAL int pcre2_match_8(const pcre2_code_8 *code, PCRE2_SPTR8 
subject, PCRE2_SIZE length,
+                                  PCRE2_SIZE startoffset, uint32_t options,
+                                  pcre2_match_data_8 *match_data, void 
*mcontext);
+
+T3_WIDGET_LOCAL int pcre2_get_error_message_8(int errorcode, PCRE2_UCHAR8 
*buffer,
+                                              PCRE2_SIZE bufflen);
+#else
+T3_WIDGET_LOCAL extern int _t3_widget_no_empty_translation_unit;
+#endif
+
+#endif  // PCRE_COMPAT_H
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libt3widget-1.0.3/src/signals.h 
new/libt3widget-1.0.6/src/signals.h
--- old/libt3widget-1.0.3/src/signals.h 2018-12-31 10:55:12.000000000 +0100
+++ new/libt3widget-1.0.6/src/signals.h 2019-05-05 10:23:54.000000000 +0200
@@ -101,12 +101,17 @@
  public:
   /// Add a callback to be called on activation.
   connection_t connect(std::function<void(Args...)> func) {
-    for (auto iter = funcs.begin(); iter != funcs.end();) {
-      if (!(*iter)->is_valid()) {
-        // Remove functions that no longer exist.
-        iter = funcs.erase(iter);
-      } else {
-        ++iter;
+    /* Only remove elements from the list if this is not called from within an 
activation. Doing so
+       within an activation will mean that we modify a list that is being 
iterated over, causing
+       invalid results. */
+    if (!in_activation_) {
+      for (auto iter = funcs.begin(); iter != funcs.end();) {
+        if (!(*iter)->is_valid()) {
+          // Remove functions that no longer exist.
+          iter = funcs.erase(iter);
+        } else {
+          ++iter;
+        }
       }
     }
     funcs.emplace_back(new internal::func_ptr_t<Args...>(func));
@@ -115,11 +120,14 @@
 
   /// Activate the signal, i.e. call all the registered active callbacks.
   void operator()(Args... args) const {
+    bool in_activation = in_activation_;
+    in_activation_ = true;
     for (const std::shared_ptr<internal::func_ptr_base_t> &func : funcs) {
       if (func->is_valid() && !func->is_blocked()) {
         static_cast<internal::func_ptr_t<Args...> 
*>(func.get())->call(args...);
       }
     }
+    in_activation_ = in_activation;
   }
 
   /** Get a callback which, when called, activates the signal.
@@ -131,6 +139,7 @@
   }
 
  private:
+  mutable bool in_activation_ = false;
   std::list<std::shared_ptr<internal::func_ptr_base_t>> funcs;
 };
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libt3widget-1.0.3/src/textbuffer.cc 
new/libt3widget-1.0.6/src/textbuffer.cc
--- old/libt3widget-1.0.3/src/textbuffer.cc     2018-12-31 10:55:12.000000000 
+0100
+++ new/libt3widget-1.0.6/src/textbuffer.cc     2019-05-05 10:23:54.000000000 
+0200
@@ -173,14 +173,7 @@
 }
 
 void text_buffer_t::replace(const finder_t &finder, const find_result_t 
&result) {
-  std::string replacement_str;
-
-  if (result.start == result.end) {
-    return;
-  }
-
-  replacement_str = 
finder.get_replacement(impl->lines[result.start.line]->get_data());
-
+  std::string replacement_str = 
finder.get_replacement(impl->lines[result.start.line]->get_data());
   replace_block(result.start, result.end, replacement_str);
 }
 
@@ -495,14 +488,12 @@
 
   // FIXME: check that everything succeeds and return false if it doesn't
   // FIXME: make sure original state is restored on failing sub action
-  // Simply insert on empty block.
-  if (start == end) {
-    return insert_block(block);
-  }
 
   start_undo_block();
   text_coordinate_t loc = std::min(start, end);
-  delete_block_internal(start, end, get_undo(UNDO_DELETE, loc));
+  if (start != end) {
+    delete_block_internal(start, end, get_undo(UNDO_DELETE, loc));
+  }
 
   converted_block = line_factory->new_text_line_t(block);
   *get_undo(UNDO_ADD, loc)->get_text() = converted_block->get_data();
@@ -852,14 +843,14 @@
   /* Note: the finder->match function does not take value of result->start.line
      and result->end.line into account. */
   result->start = start;
-  result->end.pos = std::numeric_limits<text_pos_t>::max();
+  result->end.pos = -1;
 
   for (idx = start.line; static_cast<size_t>(idx) < lines.size() && idx < 
end.line; idx++) {
     if (finder->match(lines[idx]->get_data(), result, false)) {
       result->start.line = result->end.line = idx;
       return true;
     }
-    result->start.pos = 0;
+    result->start.pos = -1;
   }
 
   result->end = end;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libt3widget-1.0.3/src/widgets/editwindow.cc 
new/libt3widget-1.0.6/src/widgets/editwindow.cc
--- old/libt3widget-1.0.3/src/widgets/editwindow.cc     2018-12-31 
10:55:12.000000000 +0100
+++ new/libt3widget-1.0.6/src/widgets/editwindow.cc     2019-05-05 
10:23:54.000000000 +0200
@@ -351,7 +351,7 @@
         info.selection_end = -1;
       }
 
-      info.cursor = impl->focus && impl->top_left.line + i == cursor.line ? 
cursor.pos : -1;
+      info.cursor = impl->top_left.line + i == cursor.line ? cursor.pos : -1;
       impl->edit_window.set_paint(i, 0);
       impl->edit_window.clrtoeol();
       text->paint_line(&impl->edit_window, impl->top_left.line + i, info);
@@ -378,7 +378,7 @@
         info.selection_end = -1;
       }
 
-      info.cursor = impl->focus && draw_line.line == cursor.line ? cursor.pos 
: -1;
+      info.cursor = draw_line.line == cursor.line ? cursor.pos : -1;
       impl->edit_window.set_paint(i, 0);
       impl->edit_window.clrtoeol();
       impl->wrap_info->paint_line(&impl->edit_window, draw_line, info);
@@ -783,17 +783,19 @@
       break;
     case find_action_t::REPLACE_ALL: {
       int replacements;
-      text_coordinate_t start(0, 0);
+      text_coordinate_t start(0, -1);
       text_coordinate_t eof(std::numeric_limits<text_pos_t>::max(),
                             std::numeric_limits<text_pos_t>::max());
 
       for (replacements = 0; text->find_limited(local_finder, start, eof, 
&result);
            replacements++) {
+        lprintf("Find result: %ld %ld\n", result.start.line, result.start.pos);
         if (replacements == 0) {
           text->start_undo_block();
         }
         text->replace(*local_finder, result);
         start = text->get_cursor();
+        lprintf("New start: %ld %ld\n", start.line, start.pos);
       }
 
       if (replacements == 0) {
@@ -1041,36 +1043,10 @@
       break;
 
     case EKEY_SHIFT | '\t':
-      if (text->get_selection_mode() != selection_mode_t::NONE &&
-          text->get_selection_start().line != text->get_selection_end().line) {
-        unindent_selection();
-      } else {
-        text->unindent_line(impl->tabsize);
-        ensure_cursor_on_screen();
-        impl->last_set_pos = impl->screen_pos;
-        text_pos_t cursor_line = text->get_cursor().line;
-        update_repaint_lines(cursor_line);
-      }
+      unindent_selection();
       break;
     case '\t':
-      if (text->get_selection_mode() != selection_mode_t::NONE &&
-          text->get_selection_start().line != text->get_selection_end().line) {
-        indent_selection();
-      } else {
-        std::string space;
-        if (text->get_selection_mode() != selection_mode_t::NONE) {
-          delete_selection();
-        }
-
-        if (impl->tab_spaces) {
-          space.append(impl->tabsize - (impl->screen_pos % impl->tabsize), ' 
');
-        } else {
-          space.append(1, '\t');
-        }
-        text->insert_block(space);
-        ensure_cursor_on_screen();
-        impl->last_set_pos = impl->screen_pos;
-      }
+      indent_selection();
       break;
     case EKEY_PASTE_START:
       if (!impl->pasting_text) {
@@ -1188,7 +1164,7 @@
      - cursor-only movements mostly don't require entire redraws [well, that 
depends:
         for matching brace/parenthesis it may require more than a single line 
update]
   */
-  if (!impl->focus && !reset_redraw()) {
+  if (!reset_redraw()) {
     return;
   }
 
@@ -1344,17 +1320,43 @@
 }
 
 void edit_window_t::indent_selection() {
-  text->indent_selection(impl->tabsize, impl->tab_spaces);
-  ensure_cursor_on_screen();
-  impl->last_set_pos = impl->screen_pos;
-  update_repaint_lines(text->get_selection_start().line, 
text->get_selection_end().line);
+  if (text->get_selection_mode() != selection_mode_t::NONE &&
+      text->get_selection_start().line != text->get_selection_end().line) {
+    text->indent_selection(impl->tabsize, impl->tab_spaces);
+    ensure_cursor_on_screen();
+    impl->last_set_pos = impl->screen_pos;
+    update_repaint_lines(text->get_selection_start().line, 
text->get_selection_end().line);
+  } else {
+    std::string space;
+    if (text->get_selection_mode() != selection_mode_t::NONE) {
+      delete_selection();
+    }
+
+    if (impl->tab_spaces) {
+      space.append(impl->tabsize - (impl->screen_pos % impl->tabsize), ' ');
+    } else {
+      space.append(1, '\t');
+    }
+    text->insert_block(space);
+    ensure_cursor_on_screen();
+    impl->last_set_pos = impl->screen_pos;
+  }
 }
 
 void edit_window_t::unindent_selection() {
-  text->unindent_selection(impl->tabsize);
-  ensure_cursor_on_screen();
-  impl->last_set_pos = impl->screen_pos;
-  update_repaint_lines(text->get_selection_start().line, 
text->get_selection_end().line);
+  if (text->get_selection_mode() != selection_mode_t::NONE &&
+      text->get_selection_start().line != text->get_selection_end().line) {
+    text->unindent_selection(impl->tabsize);
+    ensure_cursor_on_screen();
+    impl->last_set_pos = impl->screen_pos;
+    update_repaint_lines(text->get_selection_start().line, 
text->get_selection_end().line);
+  } else {
+    text->unindent_line(impl->tabsize);
+    ensure_cursor_on_screen();
+    impl->last_set_pos = impl->screen_pos;
+    text_pos_t cursor_line = text->get_cursor().line;
+    update_repaint_lines(cursor_line);
+  }
 }
 
 void edit_window_t::goto_line() {


Reply via email to