1. 24 Apr, 2019 10 commits
    • Christian Hergert's avatar
      utils: prefer snprintf() over g_snprintf() · 8aea7848
      Christian Hergert authored
      Calling g_snprintf() is much slower in a hot-loop than glibc snprintf()
      directly, so prefer that when we are on a platform that supports it.
      8aea7848
    • Christian Hergert's avatar
      AUTHORS: update active authors · 607d57b6
      Christian Hergert authored
      607d57b6
    • Chun-wei Fan's avatar
      build: Add instructions on building with Meson using Visual Studio · 511a74da
      Chun-wei Fan authored
      This outlines how one can carry out a build using Visual Studio via
      Meson, which replaces the previous Visual Studio projects.
      511a74da
    • Chun-wei Fan's avatar
      build: Drop the Visual Studio projects · dff943e4
      Chun-wei Fan authored
      Since the Meson build files are now updated to support building on
      Visual Studio, Meson is now the supported method of building
      GtkSourceView using Visual Studio, so it's time to drop the Visual
      Studio projects.
      
      The Meson build files are more comprehensive as:
      -It automatically builds the introspection files and 'installs' them, if
       GObject-Introspection is found.
      -The test programs are built and can be run for the build process.
      -It is much easier to build directly from a GIT checkout.
      dff943e4
    • Chun-wei Fan's avatar
      test-int2str.c: Use g_snprintf() · 411a2d46
      Chun-wei Fan authored
      snprintf() is not available on all platforms, and may work differently
      depending on the CRT implementation.  Use the g_snprintf() from GLib
      instead, since this is already GLib-using code.
      411a2d46
    • Chun-wei Fan's avatar
      gtksourceutils.c: Don't define variables in a for loop statement · e8dfda6c
      Chun-wei Fan authored
      pre-C99 compilers don't like this idea...
      
      Also change a call of snprintf() to g_snprintf() so that all supported
      platforms can build the code properly.
      e8dfda6c
    • Chun-wei Fan's avatar
      meson: Fix Visual Studio DLL builds · 39ef0bf7
      Chun-wei Fan authored
      Unfortunately, Visual Studio builds do not really like the concept of
      linking 2 static libraries and not using any sources for building a
      given DLL (it will not include those items when linking the final DLL as
      it will optimize most of the items out as the linker does not believe
      those items are being really used in the final DLL), so we need to do
      the following for the Visual Studio builds:
      
      -Define a separate GtkSourceView shared library target that contain the
       core sources *and* the word completion provider sources, along with the
       generated glib-mkenums and GResource sources.  This is actually how the
       Visual Studio projects build the sources for the GtkSourceView DLL, due
       to the same reasoning.
      
      -Declare the various internal dependencies accordingly; note that we
       still need the static core library for building the test programs.
       This means that on Visual Studio builds we need to build the core
       sources 2 times, it seems that this is unavoidable at this point.
       The build files for the tests in tests/ and testsuite/ has been updated
       accordingly so that things will build and link.  Note that for the
       test-stylescheme test, we need to ensure that we only link to the
       static core library, otherwise it will fail to link.
      
      -Update the enumeration source generating process, so that we include
       config.h during the build and so ensure that the symbols in the
       enumeration sources are properly exported.  This is necessary
       especially for the introspection builds on Visual Studio, as well as
       for the test programs.
      
      -For builds prior to Visual Studio 2013, we must include our math.h so
       that we can have a fallback implementation for round(), which is only
       provided in Visual Studio 2013 and later.
      39ef0bf7
    • Chun-wei Fan's avatar
      MSVC builds: Move our math.h to win32/ · 52352508
      Chun-wei Fan authored
      Move our math.h with the fallback round() implementation to win32/, and
      ensure that it is included for pre-2013 Visual Studio Meson builds.
      52352508
    • Chun-wei Fan's avatar
      meson.build: Don't check for GCC CFlags on MSVC · 26da2dc8
      Chun-wei Fan authored
      There's no point in doing that, and we already have a header from GLib
      that covers more or less the same items, so we ought to use it.
      26da2dc8
    • Chun-wei Fan's avatar
      meson.build: Manually search for libxml2 on MSVC if needed · 5b7386dd
      Chun-wei Fan authored
      The NMake Makefiles that come with libxml2 do not generate pkg-config
      files for us, so we need to look for the libxml2 headers and lib's
      manually if necessary on Visual Studio builds.
      5b7386dd
  2. 23 Apr, 2019 4 commits
  3. 21 Apr, 2019 3 commits
  4. 20 Apr, 2019 1 commit
    • Christian Hergert's avatar
      contextengine: clear invalid ranges if BOM is found · 54e48e9c
      Christian Hergert authored
      If we came across a BOM at the beginning of a buffer, then we will have
      an invalid range before we check for BOM. In that case, we need to to
      clear it before we proceed or some assertions (such as invalid range == 1)
      will not be met.
      
      Fixes #30
      54e48e9c
  5. 19 Apr, 2019 5 commits
    • Christian Hergert's avatar
      yaml: simplify map regex · 594d1a76
      Christian Hergert authored
      This reduces the complexity of the map check a bit and still matches the
      majority of cases that I tried.
      
      Fixes #47
      594d1a76
    • Christian Hergert's avatar
      388a08a4
    • Christian Hergert's avatar
      contextengine: disable highlighting in presence of long lines · 7aa29138
      Christian Hergert authored
      If we come across a pathologically long line (defined as 2000 characters),
      then disable highlighting. As highlighting is line-based, this allows us
      to protect ourselves and keep the text editor working as fast as
      GtkTextView is willing to support.
      
      In particular, this also helps mitigate against libpcre's insistance on
      stack-overflow'ing in some situations from long input combined with
      complex regexes.
      
      It would be nice if we could determine what type of regexes are likely to
      be a potential failure for this and only limit those, but this solution
      is more likely to have the secondary effect of improving performance for
      minified HTML, CSS, etc.
      
      I think a pre-requisite to remove this feature would be for GLib to move
      to using libpcre2 for GRegex (also allowing for JIT support) as well as
      GtkTextView improving beyond line-based layout/rendering (which probably
      requires character indexes within lines).
      
      Fixes #47
      7aa29138
    • Christian Hergert's avatar
      cfd2b5ce
    • Christian Hergert's avatar
      utils: avoid use of rodata for string conversion speedup · b8229fc6
      Christian Hergert authored
      The rodata version is faster, but this version is close enough that it
      warrants not having the large amount of rodata included in the overhead.
      
      This caches the previously generated string and tries to handle the common
      case of sequential printf() by incrementing the last character. If that
      overflows, we walk towards the start of the string until we do not need
      to overflow.
      
      This is still roughly 20x faster than using sprintf() directly, as we did
      previously, for sequential strings.
      b8229fc6
  6. 18 Apr, 2019 2 commits
    • Christian Hergert's avatar
      lines: use fast integer to string conversion · bb42f80f
      Christian Hergert authored
      In the vast majority of cases, we can create a fast path here that uses
      internal strings of the library to speed up line number generation instead
      of relying on g_snprintf()/gnulib/etc.
      
      The speedup is more noticable on large displays such as HiDPI.
      bb42f80f
    • Christian Hergert's avatar
      utils: add fast string conversion from Builder · 383f9e4e
      Christian Hergert authored
      This provides a string data section that contains strings from 10,000 to
      20,000 which can be used to convert integers from 0 to 20,000 with only
      a few lookups.
      
      If the value is > 20,000, then a temporary buffer will be used along with
      a g_snprintf().
      
      This can be used to significantly reduce the overhead of line number
      calculation in tight loops such as when drawing the gutter on every
      frame. Builder uses this in the OmniGutter implementation and this
      consitutes a port of that into GtkSourceView.
      383f9e4e
  7. 16 Apr, 2019 1 commit
  8. 15 Apr, 2019 1 commit
    • Christian Hergert's avatar
      stylescheme: raise priority of .current-line-number CSS · 553267f5
      Christian Hergert authored
      When using GTK CSS to set the background of the current line number, we
      need to elevate the priority so that it takes precedence over the normal
      background color styling.
      
      This now uses "textview .current-line-number" which appears to be enough
      to raise the priority.
      
      Fixes #53
      553267f5
  9. 14 Apr, 2019 1 commit
  10. 25 Mar, 2019 1 commit
  11. 21 Mar, 2019 1 commit
  12. 17 Mar, 2019 1 commit
  13. 16 Mar, 2019 1 commit
  14. 11 Mar, 2019 1 commit
  15. 02 Mar, 2019 1 commit
  16. 28 Feb, 2019 1 commit
  17. 24 Feb, 2019 1 commit
  18. 19 Feb, 2019 4 commits