lists.geany.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
List overview
Commits
November 2021
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
commits@lists.geany.org
1 participants
67 discussions
Start a n
N
ew thread
[geany/geany] 6e4a84: Migrate from Travis CI to Github Actions
by Enrico Tröger
16 Nov '21
16 Nov '21
Branch: refs/heads/master Author: Enrico Tröger <enrico.troeger(a)uvena.de> Committer: Enrico Tröger <enrico.troeger(a)uvena.de> Date: Tue, 16 Nov 2021 21:42:59 UTC Commit: 6e4a84772f07657102f8a8e3fe84608959d27ddf
https://github.com/geany/geany/commit/6e4a84772f07657102f8a8e3fe84608959d27…
Log Message: ----------- Migrate from Travis CI to Github Actions Modified Paths: -------------- .github/workflows/build.yml .travis.yml Modified: .github/workflows/build.yml 166 lines changed, 166 insertions(+), 0 deletions(-) =================================================================== @@ -0,0 +1,166 @@ +# +# Copyright: 2021, The Geany contributors +# License: GNU GPL v2 or later + +name: CI Build + +on: push +#on: +# push: +# branches: +# - master +# pull_request: +# branches: +# - master + +# cancel already running builds of the same branch or pull request +concurrency: + group: ci-${{ github.head_ref }} || concat(${{ github.ref }} + cancel-in-progress: true + +env: + CFLAGS: -g -O2 -Werror=pointer-arith -Werror=implicit-function-declaration + CCACHE_DIR: ${{ github.workspace }}/.ccache + CCACHE_COMPRESS: true + CCACHE_MAXSIZE: 1G + PYTHON: python3 + DEBUG: 0 + +jobs: + linux: + name: Linux Build (BINRELOC=${{ matrix.binreloc }}) + runs-on: ubuntu-18.04 + + strategy: + fail-fast: false + matrix: + include: + - binreloc: no + - binreloc: yes + + env: + CONFIGURE_FLAGS: --enable-binreloc=${{ matrix.binreloc }} + CC: ccache gcc + CXX: ccache g++ + + steps: + - uses: actions/checkout@v2 + + # create and use a timestamp for the cache key: GH Actions will never update a cache + # only use an existing cache item or create a new one. To use an existing cache *and* + # push back the the updated cache after build, we use a always new cache key (to force + # the creation of the cache item at the end) in combination with "restore-keys" as fallback + - name: Prepare ccache timestamp + id: ccache_cache_timestamp + run: echo "::set-output name=timestamp::$(date +%Y-%m-%d-%H-%M)" + + - name: Configure ccache + uses: actions/cache@v2 + with: + path: ${{ env.CCACHE_DIR }} + key: ${{ runner.os }}-${{ github.job }}-ccache-${{ steps.ccache_cache_timestamp.outputs.timestamp }} + restore-keys: ${{ runner.os }}-${{ github.job }}-ccache- + + - name: Show environment + run: env | sort + if: ${{ env.DEBUG == '1' }} + + - name: Install dependencies + run: | + sudo apt-get update -qq + sudo apt-get install --assume-yes --no-install-recommends \ + ccache \ + intltool \ + libtool \ + libgtk-3-dev \ + doxygen \ + python3-docutils \ + python3-lxml \ + rst2pdf + + - name: Configure + run: | + NOCONFIGURE=1 ./autogen.sh + mkdir _build + cd _build + { ../configure $CONFIGURE_FLAGS || { cat config.log; exit 1; } ; } + + - name: Build + run: | + cd _build + make + + - name: Run Tests + run: | + cd _build + make -j2 check + + - name: Run distcheck + run: | + cd _build + make -j2 distcheck DISTCHECK_CONFIGURE_FLAGS="$CONFIGURE_FLAGS"; + + - name: ccache statistics + run: ccache --show-stats + if: ${{ env.DEBUG == '1' }} + + + mingw: + name: Mingw Build + # i686-w64-mingw32-pkg-config fails with weird error message on 20.04 + runs-on: ubuntu-18.04 + env: + CC: ccache i686-w64-mingw32-gcc + CXX: ccache i686-w64-mingw32-g++ + + steps: + - uses: actions/checkout@v2 + + # create and use a timestamp for the cache key: GH Actions will never update a cache + # only use an existing cache item or create a new one. To use an existing cache *and* + # push back the the updated cache after build, we use a always new cache key (to force + # the creation of the cache item at the end) in combination with "restore-keys" as fallback + - name: Prepare ccache timestamp + id: ccache_cache_timestamp + run: echo "::set-output name=timestamp::$(date +%Y-%m-%d-%H-%M)" + + - name: Configure ccache + uses: actions/cache@v2 + with: + path: ${{ env.CCACHE_DIR }} + key: ${{ runner.os }}-${{ github.job }}-ccache-${{ steps.ccache_cache_timestamp.outputs.timestamp }} + restore-keys: ${{ runner.os }}-${{ github.job }}-ccache- + + - name: Show environment + run: env | sort + if: ${{ env.DEBUG == '1' }} + + - name: Install dependencies + run: | + sudo apt-get update -qq + sudo apt-get install --assume-yes --no-install-recommends \ + ccache \ + intltool \ + libtool \ + mingw-w64-tools \ + g++-mingw-w64-i686 \ + gcc-mingw-w64-i686 \ + binutils-mingw-w64-i686 \ + doxygen \ + python3-docutils \ + python3-lxml \ + rst2pdf + # fix broken pkg-config-crosswrapper, see
https://bugs.launchpad.net/ubuntu/+source/mingw-w64/+bug/1327242
+ sudo sed -e 's/PKG_CONFIG_PATH=/&$PKG_CONFIG_PATH:/' -i /usr/bin/i686-w64-mingw32-pkg-config + + - name: Run autogen.sh + run: | + NOCONFIGURE=1 ./autogen.sh + + - name: Build + run: | + sh ./scripts/cross-build-mingw.sh; + + - name: ccache statistics + run: ccache --show-stats + if: ${{ env.DEBUG == '1' }} Modified: .travis.yml 39 lines changed, 0 insertions(+), 39 deletions(-) =================================================================== @@ -1,39 +0,0 @@ -# we use both C and C++, so advertize C++ -language: cpp -cache: ccache -dist: bionic -compiler: - - gcc -env: - - GTK3=yes BINRELOC=no - - GTK3=yes BINRELOC=yes - - GTK3=yes MINGW=yes -before_install: - - sudo apt-get update -qq -install: - - sudo apt-get install -y intltool libtool - - test -n "$MINGW" || sudo apt-get install -y libgtk-3-dev - - test -z "$MINGW" || sudo apt-get install -y mingw-w64-tools g++-mingw-w64-i686 gcc-mingw-w64-i686 binutils-mingw-w64-i686 - # fix broken pkg-config-crosswrapper, see
https://bugs.launchpad.net/ubuntu/+source/mingw-w64/+bug/1327242
- - test -z "$MINGW" || sudo sed -e 's/PKG_CONFIG_PATH=/&$PKG_CONFIG_PATH:/' -i /usr/bin/i686-w64-mingw32-pkg-config - - sudo apt-get install -y python-docutils rst2pdf - # try not to install doxygen-latex because we don't need it and it's huge - - sudo apt-get install -y --no-install-recommends doxygen - - sudo apt-get install -y python-lxml -before_script: - - export CFLAGS="-g -O2 -Werror=pointer-arith -Werror=implicit-function-declaration" -script: - - NOCONFIGURE=1 ./autogen.sh - - > - if [ -n "$MINGW" ]; then - unset CC CXX; - sh ./scripts/cross-build-mingw.sh; - else - CONFIGURE_FLAGS="--enable-binreloc=$BINRELOC"; - mkdir _build && - cd _build && - { ../configure $CONFIGURE_FLAGS || { cat config.log; exit 1; } ; } && - make -j2 && - make -j2 check && - make -j2 distcheck DISTCHECK_CONFIGURE_FLAGS="$CONFIGURE_FLAGS"; - fi -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
[geany/geany-osx] 09c4a1: Remove some transitions that cause or may cause problems
by Jiří Techet
16 Nov '21
16 Nov '21
Branch: refs/heads/master Author: Jiří Techet <techet(a)gmail.com> Committer: Jiří Techet <techet(a)gmail.com> Date: Tue, 16 Nov 2021 20:24:59 UTC Commit: 09c4a1c6f1684e97a9757180149769f62f7347b1
https://github.com/geany/geany-osx/commit/09c4a1c6f1684e97a9757180149769f62…
Log Message: ----------- Remove some transitions that cause or may cause problems Modified Paths: -------------- Prof-Gnome/gtk-dark.css Prof-Gnome/gtk.css Modified: Prof-Gnome/gtk-dark.css 10 lines changed, 5 insertions(+), 5 deletions(-) =================================================================== @@ -4856,7 +4856,7 @@ notebook > header.bottom tab { padding-top: 1px; } notebook > stack:not(:only-child) { background-color: #454545; - transition: 300ms cubic-bezier(0.25, 0.46, 0.45, 0.94); } + /*transition: 300ms cubic-bezier(0.25, 0.46, 0.45, 0.94);*/ } * { -GtkScrollbar-has-backward-stepper: false; -GtkScrollbar-has-forward-stepper: false; } @@ -5407,16 +5407,16 @@ check:checked:not(:backdrop), check:indeterminate:not(:backdrop) { -gtk-icon-transform: unset; - transition: 400ms; + /*transition: 400ms;*/ -gtk-icon-transform: scale(0.8,0.8); } radio:checked:not(:backdrop), radio:indeterminate:not(:backdrop){ -gtk-icon-transform: unset; - transition: 400ms; + /*transition: 400ms;*/ -gtk-icon-transform: scale(1.0); - transition: 400ms; } + /*transition: 400ms;*/ } menu menuitem radio:checked:not(:backdrop), menu menuitem radio:indeterminate:not(:backdrop), @@ -6351,7 +6351,7 @@ list row { row { - transition: all 150ms cubic-bezier(0.25, 0.46, 0.45, 0.94); } + /*transition: all 150ms cubic-bezier(0.25, 0.46, 0.45, 0.94);*/ } row:hover { Modified: Prof-Gnome/gtk.css 12 lines changed, 6 insertions(+), 6 deletions(-) =================================================================== @@ -3660,7 +3660,7 @@ notebook > stack:not(:only-child) { background-color: rgba(246,246,246,0.98);/*# scrollbar { background-color: #cecece; - transition: 300ms cubic-bezier(0.25, 0.46, 0.45, 0.94); } + /*transition: 300ms cubic-bezier(0.25, 0.46, 0.45, 0.94);*/ } * { -GtkScrollbar-has-backward-stepper: false; -GtkScrollbar-has-forward-stepper: false; } @@ -4210,16 +4210,16 @@ check:checked:not(:backdrop), check:indeterminate:not(:backdrop) { -gtk-icon-transform: unset; - transition: 400ms; + /*transition: 400ms;*/ -gtk-icon-transform: scale(0.8,0.8); } radio:checked:not(:backdrop), radio:indeterminate:not(:backdrop){ -gtk-icon-transform: unset; - transition: 400ms; + /*transition: 400ms;*/ -gtk-icon-transform: scale(1.0); - transition: 400ms; } + /*transition: 400ms;*/ } menu menuitem radio:checked:not(:backdrop), menu menuitem radio:indeterminate:not(:backdrop), @@ -5088,8 +5088,8 @@ list row { padding: 0.1375rem; /*2px;*/ } row { - - transition: all 150ms cubic-bezier(0.25, 0.46, 0.45, 0.94); } + transition: none; + /*transition: all 150ms cubic-bezier(0.25, 0.46, 0.45, 0.94);*/ } row:hover { -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
[geany/geany-osx] 961e9f: Adjust radio buttons and check buttons to look more macOS-like
by Jiří Techet
16 Nov '21
16 Nov '21
Branch: refs/heads/master Author: Jiří Techet <techet(a)gmail.com> Committer: Jiří Techet <techet(a)gmail.com> Date: Tue, 16 Nov 2021 18:03:14 UTC Commit: 961e9f241d094228830f069a625c553ae6144d45
https://github.com/geany/geany-osx/commit/961e9f241d094228830f069a625c553ae…
Log Message: ----------- Adjust radio buttons and check buttons to look more macOS-like Modified Paths: -------------- Prof-Gnome/gtk-dark.css Prof-Gnome/gtk.css Modified: Prof-Gnome/gtk-dark.css 12 lines changed, 6 insertions(+), 6 deletions(-) =================================================================== @@ -5209,9 +5209,9 @@ radio:checked:hover{ color: white; -gtk-icon-source: image(-gtk-recolor(url("graphics/bullet-symbolic.svg"))); -gtk-icon-transform: scale(1.0); - -gtk-icon-shadow: 0 1px rgba(0,0,0,0.7); - border-color: #0b4082; - background-image: linear-gradient(to bottom,#0b4082,#15539e);} + /*-gtk-icon-shadow: 0 1px rgba(0,0,0,0.7);*/ + border-color: #15539e; + background-image: image(#15539e);} radio:checked:disabled{ @@ -5267,11 +5267,11 @@ check:active{ min-width:0.9625rem;/*1.1rem 16px;*/ color: #ffffff; outline-color: rgba(46, 52, 54, 0.0); - border-color: #0b4082; - background-image: linear-gradient(to bottom,#0b4082,#15539e); + border-color: #15539e; + background-image: image(#15539e); box-shadow: none; text-shadow: none; - -gtk-icon-shadow: 0 1px rgba(0,0,0,0.7); } + /*-gtk-icon-shadow: 0 1px rgba(0,0,0,0.7);*/ } check:disabled, radio:disabled { Modified: Prof-Gnome/gtk.css 12 lines changed, 6 insertions(+), 6 deletions(-) =================================================================== @@ -4010,9 +4010,9 @@ radio:checked:hover{ color: white; -gtk-icon-source: image(-gtk-recolor(url("graphics/bullet-symbolic.svg"))); -gtk-icon-transform: scale(1.0); - -gtk-icon-shadow: 0 1px rgba(0,0,0,0.7); - border-color: #1f4c83; - background-image: linear-gradient(to bottom,#2170d2,#659adc);} + /*-gtk-icon-shadow: 0 1px rgba(0,0,0,0.7);*/ + border-color: #3584e4; + background-image: image(#3584e4);} radio:checked:disabled{ @@ -4069,11 +4069,11 @@ check:active{ min-width:0.9625rem;/*1.1rem 16px;*/ color: #ffffff; outline-color: rgba(46, 52, 54, 0.0); - border-color: #1f4c83; - background-image: linear-gradient(to bottom,#2170d2,#659adc); + border-color: #3584e4; + background-image: image(#3584e4); box-shadow: none; text-shadow: none; - -gtk-icon-shadow: 0 1px rgba(0,0,0,0.7); } + /*-gtk-icon-shadow: 0 1px rgba(0,0,0,0.7);*/ } check:disabled, radio:disabled { -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
[geany/geany-osx] 8f5211: Make notebook tabs taller and make the selected tab brighter
by Jiří Techet
16 Nov '21
16 Nov '21
Branch: refs/heads/master Author: Jiří Techet <techet(a)gmail.com> Committer: Jiří Techet <techet(a)gmail.com> Date: Tue, 16 Nov 2021 17:38:21 UTC Commit: 8f5211082ed5359f37d6b13354d430aeee095c00
https://github.com/geany/geany-osx/commit/8f5211082ed5359f37d6b13354d430aee…
Log Message: ----------- Make notebook tabs taller and make the selected tab brighter Modified Paths: -------------- Prof-Gnome/gtk-dark.css Prof-Gnome/gtk.css Modified: Prof-Gnome/gtk-dark.css 12 lines changed, 8 insertions(+), 4 deletions(-) =================================================================== @@ -4591,33 +4591,37 @@ notebook > header.top { border-bottom-style: solid; } notebook > header.top > tabs { margin-bottom: -2px; } +notebook > header.top > tabs > tab { padding-top: 3px; padding-bottom: 3px; } + notebook > header.top > tabs > tab:hover { box-shadow: inset 0 -0.20625rem #737373; } -notebook > header.top > tabs > tab:checked { box-shadow: inset 0 -0.20625rem #15539e; } +notebook > header.top > tabs > tab:checked { background-color: #444444; box-shadow: inset 0 -0.20625rem #15539e; } notebook > header.bottom { border-top-style: solid; } notebook > header.bottom > tabs { margin-top: -0.1375rem;/*-2px;*/ } +notebook > header.bottom > tabs > tab { padding-top: 3px; padding-bottom: 3px; } + notebook > header.bottom > tabs > tab:hover { box-shadow: inset 0 0.20625rem #737373; } -notebook > header.bottom > tabs > tab:checked { box-shadow: inset 0 0.20625rem #15539e; } +notebook > header.bottom > tabs > tab:checked { background-color: #444444; box-shadow: inset 0 0.20625rem #15539e; } notebook > header.left { border-right-style: solid; } notebook > header.left > tabs { margin-right: -0.1375rem;/*-2px;*/ } notebook > header.left > tabs > tab:hover { box-shadow: inset -0.20625rem 0 #737373; } -notebook > header.left > tabs > tab:checked { box-shadow: inset -0.20625rem 0 #15539e; } +notebook > header.left > tabs > tab:checked { background-color: #444444; box-shadow: inset -0.20625rem 0 #15539e; } notebook > header.right { border-left-style: solid; } notebook > header.right > tabs { margin-left: -0.1375rem;/*-2px;*/ } notebook > header.right > tabs > tab:hover { box-shadow: inset 0.20625rem 0 #737373; } -notebook > header.right > tabs > tab:checked { box-shadow: inset 0.20625rem 0 #15539e; } +notebook > header.right > tabs > tab:checked { background-color: #444444; box-shadow: inset 0.20625rem 0 #15539e; } notebook > header.top > tabs > arrow { border-top-style: none; } Modified: Prof-Gnome/gtk.css 12 lines changed, 8 insertions(+), 4 deletions(-) =================================================================== @@ -3426,33 +3426,37 @@ notebook > header.top { border-bottom-style: solid; } notebook > header.top > tabs { margin-bottom: -2px; } +notebook > header.top > tabs > tab { padding-top: 3px; padding-bottom: 3px; } + notebook > header.top > tabs > tab:hover { box-shadow: inset 0 -0.20625rem #909090; } -notebook > header.top > tabs > tab:checked { box-shadow: inset 0 -0.20625rem #3584e4; } +notebook > header.top > tabs > tab:checked { background-color: #fbfbfb; box-shadow: inset 0 -0.20625rem #3584e4; } notebook > header.bottom { border-top-style: solid; } notebook > header.bottom > tabs { margin-top: -0.1375rem;/*-2px;*/ } +notebook > header.bottom > tabs > tab { padding-top: 3px; padding-bottom: 3px; } + notebook > header.bottom > tabs > tab:hover { box-shadow: inset 0 0.20625rem #909090; } -notebook > header.bottom > tabs > tab:checked { box-shadow: inset 0 0.20625rem #3584e4; } +notebook > header.bottom > tabs > tab:checked { background-color: #fbfbfb; box-shadow: inset 0 0.20625rem #3584e4; } notebook > header.left { border-right-style: solid; } notebook > header.left > tabs { margin-right: -0.1375rem;/*-2px;*/ } notebook > header.left > tabs > tab:hover { box-shadow: inset -0.20625rem 0 #909090; } -notebook > header.left > tabs > tab:checked { box-shadow: inset -0.20625rem 0 #3584e4; } +notebook > header.left > tabs > tab:checked { background-color: #fbfbfb; box-shadow: inset -0.20625rem 0 #3584e4; } notebook > header.right { border-left-style: solid; } notebook > header.right > tabs { margin-left: -0.1375rem;/*-2px;*/ } notebook > header.right > tabs > tab:hover { box-shadow: inset 0.20625rem 0 #909090; } -notebook > header.right > tabs > tab:checked { box-shadow: inset 0.20625rem 0 #3584e4; } +notebook > header.right > tabs > tab:checked { background-color: #fbfbfb; box-shadow: inset 0.20625rem 0 #3584e4; } notebook > header.top > tabs > arrow { border-top-style: none; } -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
[geany/geany-osx] c85588: Add Prof Gnome Light 3.6 theme
by Jiří Techet
16 Nov '21
16 Nov '21
Branch: refs/heads/master Author: Jiří Techet <techet(a)gmail.com> Committer: Jiří Techet <techet(a)gmail.com> Date: Tue, 16 Nov 2021 17:32:39 UTC Commit: c85588e8e6613a851dfc1de6e3ffc4f7d06933e6
https://github.com/geany/geany-osx/commit/c85588e8e6613a851dfc1de6e3ffc4f7d…
Log Message: ----------- Add Prof Gnome Light 3.6 theme Modified Paths: -------------- Prof-Gnome/graphics/background.png Prof-Gnome/graphics/blurredT.png Prof-Gnome/graphics/bullet-symbolic.svg Prof-Gnome/graphics/list-remove-symbolic.svg Prof-Gnome/graphics/object-select-symbolic.svg Prof-Gnome/graphics/object-select-symbolic(a)2.svg Prof-Gnome/gtk-dark.css Prof-Gnome/gtk.css Modified: Prof-Gnome/graphics/background.png 0 lines changed, 0 insertions(+), 0 deletions(-) =================================================================== No diff available, check online Modified: Prof-Gnome/graphics/blurredT.png 0 lines changed, 0 insertions(+), 0 deletions(-) =================================================================== No diff available, check online Modified: Prof-Gnome/graphics/bullet-symbolic.svg 155 lines changed, 155 insertions(+), 0 deletions(-) =================================================================== @@ -0,0 +1,155 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (
http://www.inkscape.org/
) --> + +<svg + xmlns:osb="
http://www.openswatchbook.org/uri/2009/osb
" + xmlns:dc="
http://purl.org/dc/elements/1.1/
" + xmlns:cc="
http://creativecommons.org/ns#
" + xmlns:rdf="
http://www.w3.org/1999/02/22-rdf-syntax-ns#
" + xmlns:svg="
http://www.w3.org/2000/svg
" + xmlns="
http://www.w3.org/2000/svg
" + xmlns:sodipodi="
http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd
" + xmlns:inkscape="
http://www.inkscape.org/namespaces/inkscape
" + sodipodi:docname="bullet-symbolic.svg" + inkscape:export-filename="/home/sam/dev/RESOURCES/gnome-icon-theme-symbolic/src/gnome-stencils.png" + inkscape:export-xdpi="90" + inkscape:export-ydpi="90" + height="14" + id="svg7384" + version="1.1" + inkscape:version="0.92.4 (5da689c313, 2019-01-14)" + width="14"> + <metadata + id="metadata90"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="
http://purl.org/dc/dcmitype/StillImage
" /> + <dc:title>Gnome Symbolic Icon Theme</dc:title> + </cc:Work> + </rdf:RDF> + </metadata> + <sodipodi:namedview + inkscape:bbox-nodes="true" + inkscape:bbox-paths="true" + bordercolor="#666666" + borderopacity="1" + inkscape:current-layer="layer9" + inkscape:cx="-7.5736807" + inkscape:cy="5.5864571" + gridtolerance="10" + inkscape:guide-bbox="true" + guidetolerance="10" + id="namedview88" + inkscape:object-nodes="true" + inkscape:object-paths="false" + objecttolerance="10" + pagecolor="#3a3b39" + inkscape:pageopacity="1" + inkscape:pageshadow="2" + showborder="true" + showgrid="false" + showguides="true" + inkscape:snap-bbox="true" + inkscape:snap-bbox-midpoints="false" + inkscape:snap-global="true" + inkscape:snap-grids="true" + inkscape:snap-nodes="false" + inkscape:snap-others="false" + inkscape:snap-to-guides="true" + inkscape:window-height="1016" + inkscape:window-maximized="1" + inkscape:window-width="1854" + inkscape:window-x="66" + inkscape:window-y="27" + inkscape:zoom="22.005438" + inkscape:showpageshadow="false"> + <inkscape:grid + dotted="false" + empspacing="2" + enabled="true" + id="grid4866" + originx="-139.99995" + originy="120" + snapvisiblegridlinesonly="true" + spacingx="1" + spacingy="1" + type="xygrid" + visible="true" /> + </sodipodi:namedview> + <title + id="title9167">Gnome Symbolic Icon Theme</title> + <defs + id="defs7386"> + <linearGradient + gradientTransform="matrix(-2.7365795,0.28202934,-0.18908311,-0.99988321,239.54008,-879.45557)" + id="linearGradient19282" + osb:paint="solid"> + <stop + id="stop19284" + offset="0" + style="stop-color:#666666;stop-opacity:1;" /> + </linearGradient> + </defs> + <g + inkscape:groupmode="layer" + id="layer9" + inkscape:label="status" + style="display:inline" + transform="translate(-381.00015,-339)"> + <path + inkscape:connector-curvature="0" + d="m 388.00015,343 c -1.65555,0 -3,1.34444 -3,3 0,1.65555 1.34445,3 3,3 1.65555,0 3,-1.34445 3,-3 0,-1.65556 -1.34445,-3 -3,-3 z" + id="path9555" + sodipodi:nodetypes="csssc" + style="color:#bebebe;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:'Andale Mono';text-indent:0pt;text-align:start;text-decoration:none;text-decoration-line:none;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;text-anchor:start;display:inline;overflow:visible;visibility:visible;fill:#bebebe;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1.79172564;marker:none" /> + </g> + <g + inkscape:groupmode="layer" + id="layer10" + inkscape:label="devices" + style="display:inline" + transform="translate(-381.00015,-339)" /> + <g + inkscape:groupmode="layer" + id="layer11" + inkscape:label="apps" + transform="translate(-381.00015,-339)" /> + <g + inkscape:groupmode="layer" + id="layer13" + inkscape:label="places" + style="display:inline" + transform="translate(-381.00015,-339)" /> + <g + inkscape:groupmode="layer" + id="layer14" + inkscape:label="mimetypes" + transform="translate(-381.00015,-339)" /> + <g + inkscape:groupmode="layer" + id="layer15" + inkscape:label="emblems" + style="display:inline" + transform="translate(-381.00015,-339)" /> + <g + inkscape:groupmode="layer" + id="g71291" + inkscape:label="emotes" + style="display:inline" + transform="translate(-381.00015,-339)" /> + <g + inkscape:groupmode="layer" + id="g4953" + inkscape:label="categories" + style="display:inline" + transform="translate(-381.00015,-339)" /> + <g + inkscape:groupmode="layer" + id="layer12" + inkscape:label="actions" + style="display:inline" + transform="translate(-381.00015,-339)" /> +</svg> Modified: Prof-Gnome/graphics/list-remove-symbolic.svg 58 lines changed, 58 insertions(+), 0 deletions(-) =================================================================== @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="
http://purl.org/dc/elements/1.1/
" + xmlns:cc="
http://creativecommons.org/ns#
" + xmlns:rdf="
http://www.w3.org/1999/02/22-rdf-syntax-ns#
" + xmlns:svg="
http://www.w3.org/2000/svg
" + xmlns="
http://www.w3.org/2000/svg
" + xmlns:sodipodi="
http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd
" + xmlns:inkscape="
http://www.inkscape.org/namespaces/inkscape
" + width="16" + height="16" + version="1.1" + id="svg4" + sodipodi:docname="list-remove-symbolic.svg" + inkscape:version="0.92.4 (5da689c313, 2019-01-14)"> + <metadata + id="metadata10"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="
http://purl.org/dc/dcmitype/StillImage
" /> + </cc:Work> + </rdf:RDF> + </metadata> + <defs + id="defs8" /> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1697" + inkscape:window-height="997" + id="namedview6" + showgrid="true" + inkscape:zoom="50.6875" + inkscape:cx="4.1331689" + inkscape:cy="8" + inkscape:window-x="66" + inkscape:window-y="27" + inkscape:window-maximized="0" + inkscape:current-layer="svg4"> + <inkscape:grid + type="xygrid" + id="grid12" /> + </sodipodi:namedview> + <path + style="fill:#bebebe;stroke-width:0.84515429;fill-opacity:1" + d="M 3,7 H 13 V 9 H 3 Z" + id="path2" + inkscape:connector-curvature="0" /> +</svg> Modified: Prof-Gnome/graphics/object-select-symbolic.svg 56 lines changed, 56 insertions(+), 0 deletions(-) =================================================================== @@ -0,0 +1,56 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="
http://purl.org/dc/elements/1.1/
" + xmlns:cc="
http://creativecommons.org/ns#
" + xmlns:rdf="
http://www.w3.org/1999/02/22-rdf-syntax-ns#
" + xmlns:svg="
http://www.w3.org/2000/svg
" + xmlns="
http://www.w3.org/2000/svg
" + xmlns:sodipodi="
http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd
" + xmlns:inkscape="
http://www.inkscape.org/namespaces/inkscape
" + width="16" + height="16" + version="1.1" + id="svg4" + sodipodi:docname="object-select-symbolic.svg" + inkscape:version="0.92.4 (5da689c313, 2019-01-14)"> + <metadata + id="metadata10"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="
http://purl.org/dc/dcmitype/StillImage
" /> + <dc:title /> + </cc:Work> + </rdf:RDF> + </metadata> + <defs + id="defs8" /> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1854" + inkscape:window-height="1016" + id="namedview6" + showgrid="false" + inkscape:zoom="51.875" + inkscape:cx="4.2216867" + inkscape:cy="8" + inkscape:window-x="66" + inkscape:window-y="27" + inkscape:window-maximized="1" + inkscape:current-layer="svg4" /> + <path + style="fill:#bebebe;fill-opacity:1" + d="M 11.940017,3.0993136 6.0677966,9.9508305 4.0211864,7.9715169 C 3.5593864,7.5218169 2.739173,7.7171796 2.359173,8.0871796 1.989173,8.4671796 1.8543,9.2947 2.31,9.7505 L 6.09,13.5 13.779,4.6905 C 14.538,3.8206 12.876017,2.0274136 11.940017,3.0993136 Z" + id="path2" + inkscape:connector-curvature="0" + sodipodi:nodetypes="cccccccc" /> +</svg> Modified: Prof-Gnome/graphics/object-select-symbolic(a)2.svg 56 lines changed, 56 insertions(+), 0 deletions(-) =================================================================== @@ -0,0 +1,56 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="
http://purl.org/dc/elements/1.1/
" + xmlns:cc="
http://creativecommons.org/ns#
" + xmlns:rdf="
http://www.w3.org/1999/02/22-rdf-syntax-ns#
" + xmlns:svg="
http://www.w3.org/2000/svg
" + xmlns="
http://www.w3.org/2000/svg
" + xmlns:sodipodi="
http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd
" + xmlns:inkscape="
http://www.inkscape.org/namespaces/inkscape
" + width="40" + height="40" + version="1.1" + id="svg4" + sodipodi:docname="object-select-symbolic(a)2.svg" + inkscape:version="0.92.4 (5da689c313, 2019-01-14)"> + <metadata + id="metadata10"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="
http://purl.org/dc/dcmitype/StillImage
" /> + <dc:title /> + </cc:Work> + </rdf:RDF> + </metadata> + <defs + id="defs8" /> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1854" + inkscape:window-height="1016" + id="namedview6" + showgrid="false" + inkscape:zoom="20.75" + inkscape:cx="1.6626507" + inkscape:cy="20" + inkscape:window-x="66" + inkscape:window-y="27" + inkscape:window-maximized="1" + inkscape:current-layer="svg4" /> + <path + style="fill:#bebebe;stroke-width:2.51029706;fill-opacity:1" + d="M 29.99221,7.495803 15.25119,24.695147 10.113591,19.726481 C 8.9543352,18.597601 6.8953558,19.08802 5.9414429,20.016829 5.012633,20.970742 4.6740616,23.048063 5.8180049,24.192257 L 15.306927,33.604616 34.608602,11.490154 C 36.513919,9.306446 32.341847,4.805016 29.99221,7.495803 Z" + id="path2" + inkscape:connector-curvature="0" + sodipodi:nodetypes="cccccccc" /> +</svg> Modified: Prof-Gnome/gtk-dark.css 7952 lines changed, 7952 insertions(+), 0 deletions(-) =================================================================== No diff available, check online Modified: Prof-Gnome/gtk.css 6452 lines changed, 6452 insertions(+), 0 deletions(-) =================================================================== No diff available, check online -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
[geany/geany-osx] 914fbe: Update to latest version of working modules
by Jiří Techet
15 Nov '21
15 Nov '21
Branch: refs/heads/master Author: Jiří Techet <techet(a)gmail.com> Committer: Jiří Techet <techet(a)gmail.com> Date: Mon, 15 Nov 2021 16:41:24 UTC Commit: 914fbefe2e3555c08a82e27d0cb70de02df8235d
https://github.com/geany/geany-osx/commit/914fbefe2e3555c08a82e27d0cb70de02…
Log Message: ----------- Update to latest version of working modules Modified Paths: -------------- modulesets-stable/bootstrap.modules modulesets-stable/gtk-osx-bootstrap.modules modulesets-stable/gtk-osx-network.modules modulesets-stable/gtk-osx-random.modules modulesets-stable/gtk-osx.modules patches/libtool-apple-sort.patch patches/libxml2-python-config.patch patches/shared-mime-info-2.1-freedesktop-generate.patch Modified: modulesets-stable/bootstrap.modules 4 lines changed, 3 insertions(+), 1 deletions(-) =================================================================== @@ -74,7 +74,9 @@ <autotools id="libtool" autogen-sh="configure" bootstrap="true"> <branch repo="
ftp.gnu.org
" module="libtool/libtool-2.4.6.tar.gz" version="2.4.6" - hash="e3bd4d5d3d025a36c21dd6af7ea818a2afcd4dfc1ea5a17b39d7854bcd0c06e3"/> + hash="sha256:e3bd4d5d3d025a36c21dd6af7ea818a2afcd4dfc1ea5a17b39d7854bcd0c06e3"> + <patch file="libtool-apple-sort.patch" strip="1"/> + </branch> </autotools> Modified: modulesets-stable/gtk-osx-bootstrap.modules 10 lines changed, 5 insertions(+), 5 deletions(-) =================================================================== @@ -41,7 +41,7 @@ <branch version="4.2.0" module="libtiff/tiff-4.2.0.tar.gz" repo="libtiff" hash="sha256:eb0484e568ead8fa23b513e9b0041df7e327f4ee2d22db5a533929dfc19633cb"> - <patch file="
https://raw.githubusercontent.com/totaam/gtk-osx-build/master/patches/tiff-…
" strip="1" /> + <patch file="tiff-nohtml.patch" strip="1" /> </branch> <dependencies> <dep package="libjpeg"/> @@ -54,12 +54,12 @@ module won't link. In case you're wondering, itstool needs libxml2's python module. --> - <autotools id="libxml2" autogen-sh="configure" + <autotools id="libxml2" autogen-sh="autoreconf" autogenargs='--libdir="$JHBUILD_LIBDIR" --with-python'> - <branch version="2.9.10" module="libxml2-2.9.10.tar.gz" + <branch version="2.9.12" module="libxml2-2.9.12.tar.gz" repo="
xmlsoft.org
" - hash="sha256:aafee193ffb8fe0c82d4afef6ef91972cbaf5feea100edc2f262750611b4be1f"> - <patch file="libxml2.9.10-conditional-parentheses.patch" strip="1"/> + hash="sha256:c8d6681e38c56f172892c85ddc0852e1fd4b53b4209e7f4ebf17f7e2eae71d92"> + <patch file="libxml2-python-config.patch" strip="1"/> </branch> <after> <dep package="python2"/> Modified: modulesets-stable/gtk-osx-network.modules 40 lines changed, 29 insertions(+), 11 deletions(-) =================================================================== @@ -35,17 +35,33 @@ </autotools> <!-- Rudely demands TeX to build documentation --> - <autotools id="libnettle" autogen-sh="configure" - autogenargs="--disable-documentation"> - <branch repo="
ftp.gnu.org
" version="3.7.2" - module="nettle/nettle-3.7.2.tar.gz" - hash="sha256:8d2a604ef1cde4cd5fb77e422531ea25ad064679ff0adf956e78b3352e0ef162"> - </branch> - <dependencies> - <dep package="gmp"/> - <dep package="openssl"/> - </dependencies> - </autotools> + <!-- libnettle 3.7 doesn't have arm64 assembler support and the support that's added in master is for arm-64-neutron that's incompatible with Apple Silicon. --> + <if condition-set="arm64"> + <autotools id="libnettle" autogen-sh="configure" + autogenargs="--disable-documentation --disable-assembler"> + <branch repo="
ftp.gnu.org
" version="3.7.2" + module="nettle/nettle-3.7.2.tar.gz" + hash="sha256:8d2a604ef1cde4cd5fb77e422531ea25ad064679ff0adf956e78b3352e0ef162"> + </branch> + <dependencies> + <dep package="gmp"/> + <dep package="openssl"/> + </dependencies> + </autotools> + </if> + <if condition-unset="arm64"> + <autotools id="libnettle" autogen-sh="configure" + autogenargs="--disable-documentation"> + <branch repo="
ftp.gnu.org
" version="3.7.2" + module="nettle/nettle-3.7.2.tar.gz" + hash="sha256:8d2a604ef1cde4cd5fb77e422531ea25ad064679ff0adf956e78b3352e0ef162"> + </branch> + <dependencies> + <dep package="gmp"/> + <dep package="openssl"/> + </dependencies> + </autotools> + </if> <autotools id="libtasn1" autogen-sh="configure"> <branch repo="
ftp.gnu.org
" version="4.17.0" @@ -69,6 +85,7 @@ hash="sha256:8a8f40153dd5a3f8e7c03e641f8db400133fb2a6a9ab2aee1b6d0cb0495ec6b6"> </branch> <dependencies> + <dep package="libffi"/> <dep package="libtasn1"/> </dependencies> </autotools> @@ -85,6 +102,7 @@ <dep package="libtasn1"/> <dep package="zlib"/> <dep package="p11-kit"/> + <dep package="libgcrypt"/> </dependencies> </autotools> </if> Modified: modulesets-stable/gtk-osx-random.modules 1 lines changed, 1 insertions(+), 0 deletions(-) =================================================================== @@ -138,6 +138,7 @@ <branch module="0ee50652091363ab0d17e335e5e74fbe/shared-mime-info-2.1.tar.xz" repo="shared-mime-info" version="2.1" hash="sha256:b2d40cfcdd84e835d0f2c9107b3f3e77e9cf912f858171fe779946da634e8563"> + <patch file="shared-mime-info-2.1-freedesktop-generate.patch" strip="1"/> </branch> <dependencies> <dep package="glib"/> Modified: modulesets-stable/gtk-osx.modules 8 lines changed, 4 insertions(+), 4 deletions(-) =================================================================== @@ -233,7 +233,7 @@ </after> </meson> - <meson id="gdk-pixbuf" mesonargs="-Dman=false"> + <meson id="gdk-pixbuf" mesonargs="-Drelocatable=true -Dman=false"> <branch module="gdk-pixbuf/2.42/gdk-pixbuf-2.42.4.tar.xz" version="2.42.4" hash="sha256:fe9c5dd88f486194ea2bc09b8814c1ed895bb6c530f37cbbf259757c4e482e4d"> <patch file="gdk-pixbuf-loader-name.patch" strip="1"/> @@ -294,8 +294,7 @@ </meson> <!-- gtk3 is in maintenance mode with 3.24 the final release series. --> - <meson id="gtk+-3.0" - mesonargs="-Dquartz_backend=true -Dx11_backend=false"> + <meson id="gtk+-3.0" mesonargs="-Dx11_backend=false"> <branch module="gtk+/3.24/gtk+-3.24.30.tar.xz" version="3.24.30" hash="sha256:ba75bfff320ad1f4cfbee92ba813ec336322cc3c660d406aad014b07087a3ba9"> <patch file="Quartz-version-detection-for-macOS-12.patch" strip="1"/> @@ -367,7 +366,8 @@ hash="sha256:767ec234ae7aa684695b3a735548224888132e063f92db585759b422570621d4"/> </autotools> - <autotools id="librsvg" autogenargs="--disable-Bsymbolic"> + <autotools id="librsvg" autogen-sh="autoreconf" + autogenargs="--disable-Bsymbolic"> <branch module="librsvg/2.51/librsvg-2.51.0.tar.xz" version="2.51.0" hash="sha256:89d32e38445025e1b1d9af3dd9d3aeb9f6fce527aeecbecf38b369b34c80c038"/> <dependencies> Modified: patches/libtool-apple-sort.patch 38 lines changed, 38 insertions(+), 0 deletions(-) =================================================================== @@ -0,0 +1,38 @@ +--- a/Makefile.am 2015-01-20 07:34:33.000000000 -0800 ++++ b/Makefile.am 2021-11-12 10:18:23.000000000 -0800 +@@ -416,8 +416,8 @@ + # files created in the build tree, so instead we regenerate the + # manual pages if the sources for the build-tree files we want to + # run have changed. +-$(libtool_1): $(ltmain_sh) +- $(AM_V_GEN)$(update_mans) --help-option=--help-all libtool ++#$(libtool_1): $(ltmain_sh) ++# $(AM_V_GEN)$(update_mans) --help-option=--help-all libtool + $(libtoolize_1): $(libtoolize_in) + $(AM_V_GEN)$(update_mans) libtoolize + +--- s/Makefile.in 2015-02-15 08:14:14.000000000 -0800 ++++ b/Makefile.in 2021-11-12 10:26:26.000000000 -0800 +@@ -2324,8 +2324,8 @@ + # files created in the build tree, so instead we regenerate the + # manual pages if the sources for the build-tree files we want to + # run have changed. +-$(libtool_1): $(ltmain_sh) +- $(AM_V_GEN)$(update_mans) --help-option=--help-all libtool ++#$(libtool_1): $(ltmain_sh) ++# $(AM_V_GEN)$(update_mans) --help-option=--help-all libtool + $(libtoolize_1): $(libtoolize_in) + $(AM_V_GEN)$(update_mans) libtoolize + +--- a/build-aux/ltmain.in 2015-02-06 04:57:56.000000000 -0800 ++++ b/build-aux/ltmain.in 2021-11-08 14:58:33.000000000 -0800 +@@ -3188,7 +3188,7 @@ + if test yes = "$lock_old_archive_extraction"; then + $opt_dry_run || rm -f "$lockfile" + fi +- if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then ++ if ($AR t "$f_ex_an_ar_oldlib" | sort -u | sort -c >/dev/null 2>&1); then + : + else + func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" + Modified: patches/libxml2-python-config.patch 23 lines changed, 23 insertions(+), 0 deletions(-) =================================================================== @@ -0,0 +1,23 @@ +--- a/configure.ac 2021-05-13 11:44:23.000000000 -0700 ++++ b/configure.ac 2021-11-08 11:13:54.000000000 -0800 +@@ -905,7 +905,17 @@ + fi + fi + pythondir='$(PYTHON_SITE_PACKAGES)' +- PYTHON_LIBS=`python$PYTHON_VERSION-config --ldflags` ++ py_ver_major=$(echo $PYTHON_VERSION | cut -d . -f 1) ++ py_ver_minor=$(echo $PYTHON_VERSION | cut -d . -f 2) ++ if test $py_ver_major -eq 3 -a $py_ver_minor -ge 8 ++ then ++ PYTHON_LIBS=`python$PYTHON_VERSION-config --ldflags --embed` ++ elif test $py_ver_major -gt 3 ++ then ++ PYTHON_LIBS=`python$PYTHON_VERSION-config --ldflags --embed` ++ else ++ PYTHON_LIBS=`python$PYTHON_VERSION-config --ldflags` ++ fi + else + PYTHON= + fi + +Diff finished. Mon Nov 8 11:28:35 2021 Modified: patches/shared-mime-info-2.1-freedesktop-generate.patch 27 lines changed, 27 insertions(+), 0 deletions(-) =================================================================== @@ -0,0 +1,27 @@ +--- a/data/freedesktop_generate.sh 2020-12-31 11:12:16.000000000 -0800 ++++ b/data/freedesktop_generate.sh 2021-11-07 13:50:19.000000000 -0800 +@@ -3,10 +3,17 @@ + src_root="$1" + build_root="$2" + +-ninja -C "${build_root}" shared-mime-info-gmo +- +-itstool \ +- --its "${src_root}/data/its/shared-mime-info.its" \ +- --join "${src_root}/data/freedesktop.org.xml.in" \ +- -o "${build_root}/data/freedesktop.org.xml" \ +- "${build_root}/po/"*".gmo" ++if test ! -d "${build_root}/po/de"; then ++ ninja -C "${build_root}" shared-mime-info-gmo ++ itstool \ ++ --its "${src_root}/data/its/shared-mime-info.its" \ ++ --join "${src_root}/data/freedesktop.org.xml.in" \ ++ -o "${build_root}/data/freedesktop.org.xml" \ ++ "${build_root}/po/"*".gmo" ++else ++ itstool \ ++ --its "${src_root}/data/its/shared-mime-info.its" \ ++ --join "${src_root}/data/freedesktop.org.xml.in" \ ++ -o "${build_root}/data/freedesktop.org.xml" \ ++ "${build_root}/po/"*"/LC_MESSAGES/shared-mime-info.mo" ++fi -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
[geany/geany] fb7ab2: Update to Scintilla 5.1.4 and Lexilla 5.1.3
by Thomas Martitz
15 Nov '21
15 Nov '21
Branch: refs/heads/master Author: Thomas Martitz <thomas.martitz(a)mailbox.org> Committer: Thomas Martitz <thomas.martitz(a)mailbox.org> Date: Mon, 15 Nov 2021 06:46:40 UTC Commit: fb7ab270d9e20b2d39f1d14b9a45c6967e691a84
https://github.com/geany/geany/commit/fb7ab270d9e20b2d39f1d14b9a45c6967e691…
Log Message: ----------- Update to Scintilla 5.1.4 and Lexilla 5.1.3 Scintilla: - On GTK, fix primary selection paste within same instance. Bug #2287. - On GTK, fix potential crash when closing Scintilla instances due to releasing global settings object. Lexilla: - Various Rust fixes Modified Paths: -------------- scintilla/gtk/PlatGTK.cxx scintilla/gtk/ScintillaGTK.cxx scintilla/gtk/ScintillaGTK.h scintilla/include/Scintilla.h scintilla/include/Scintilla.iface scintilla/include/ScintillaCall.h scintilla/include/ScintillaTypes.h scintilla/lexilla/lexers/LexPython.cxx scintilla/lexilla/lexers/LexRust.cxx scintilla/lexilla/lexlib/Accessor.h scintilla/lexilla/lexlib/LexerBase.cxx scintilla/lexilla/lexlib/WordList.cxx scintilla/lexilla/version.txt scintilla/src/CellBuffer.cxx scintilla/src/CharClassify.cxx scintilla/src/CharacterType.h scintilla/src/ContractionState.cxx scintilla/src/Document.cxx scintilla/src/Document.h scintilla/src/EditView.cxx scintilla/src/Editor.cxx scintilla/src/KeyMap.cxx scintilla/src/MarginView.cxx scintilla/src/MarginView.h scintilla/src/PerLine.cxx scintilla/src/PositionCache.cxx scintilla/src/PositionCache.h scintilla/src/ViewStyle.cxx scintilla/src/ViewStyle.h scintilla/src/XPM.cxx scintilla/src/XPM.h scintilla/version.txt Modified: scintilla/gtk/PlatGTK.cxx 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -114,7 +114,7 @@ class FontHandle : public Font { FontHandle(FontHandle &&) = delete; FontHandle &operator=(const FontHandle &) = delete; FontHandle &operator=(FontHandle &&) = delete; - ~FontHandle() { + ~FontHandle() override { if (pfd) pango_font_description_free(pfd); pfd = nullptr; Modified: scintilla/gtk/ScintillaGTK.cxx 26 lines changed, 13 insertions(+), 13 deletions(-) =================================================================== @@ -282,9 +282,6 @@ ScintillaGTK::~ScintillaGTK() { if (settingsHandlerId) { g_signal_handler_disconnect(settings, settingsHandlerId); } - if (settings) { - g_object_unref(settings); - } } void ScintillaGTK::RealizeThis(GtkWidget *widget) { @@ -1303,7 +1300,7 @@ struct CaseMapper { } std::string ScintillaGTK::CaseMapString(const std::string &s, CaseMapping caseMapping) { - if ((s.size() == 0) || (caseMapping == CaseMapping::same)) + if (s.empty() || (caseMapping == CaseMapping::same)) return s; if (IsUnicodeMode()) { @@ -1566,20 +1563,26 @@ void ScintillaGTK::GetGtkSelectionText(GtkSelectionData *selectionData, Selectio void ScintillaGTK::InsertSelection(GtkClipboard *clipBoard, GtkSelectionData *selectionData) { const gint length = gtk_selection_data_get_length(selectionData); + const GdkAtom selection = gtk_selection_data_get_selection(selectionData); if (length >= 0) { - GdkAtom selection = gtk_selection_data_get_selection(selectionData); SelectionText selText; GetGtkSelectionText(selectionData, selText); UndoGroup ug(pdoc); if (selection == GDK_SELECTION_CLIPBOARD) { ClearSelection(multiPasteMode == MultiPaste::Each); } + if (selection == GDK_SELECTION_PRIMARY) { + SetSelection(posPrimary, posPrimary); + } InsertPasteShape(selText.Data(), selText.Length(), selText.rectangular ? PasteShape::rectangular : PasteShape::stream); EnsureCaretVisible(); } else { + if (selection == GDK_SELECTION_PRIMARY) { + SetSelection(posPrimary, posPrimary); + } GdkAtom target = gtk_selection_data_get_target(selectionData); if (target == atomUTF8) { // In case data is actually only stored as text/plain;charset=utf-8 not UTF8_STRING @@ -1653,7 +1656,7 @@ void ScintillaGTK::GetSelection(GtkSelectionData *selection_data, guint info, Se std::unique_ptr<SelectionText> newline_normalized; { std::string tmpstr = Document::TransformLineEnds(text->Data(), text->Length(), EndOfLine::Lf); - newline_normalized.reset(new SelectionText()); + newline_normalized = std::make_unique<SelectionText>(); newline_normalized->Copy(tmpstr, CpUtf8, CharacterSet::Ansi, text->rectangular, false); text = newline_normalized.get(); } @@ -1880,12 +1883,11 @@ gint ScintillaGTK::PressThis(GdkEventButton *event) { ButtonDownWithModifiers(pt, event->time, ModifierFlags(shift, ctrl, alt, meta)); } else if (event->button == 2) { // Grab the primary selection if it exists - const SelectionPosition pos = SPositionFromLocation(pt, false, false, UserVirtualSpace()); + posPrimary = SPositionFromLocation(pt, false, false, UserVirtualSpace()); if (OwnPrimarySelection() && primary.Empty()) CopySelectionRange(&primary); sel.Clear(); - SetSelection(pos, pos); RequestSelection(GDK_SELECTION_PRIMARY); } else if (event->button == 3) { if (!PointInSelection(pt)) @@ -2449,7 +2451,7 @@ std::vector<int> MapImeIndicators(PangoAttrList *attrs, const char *u8Str) { void ScintillaGTK::SetCandidateWindowPos() { // Composition box accompanies candidate box. const Point pt = PointMainCaret(); - GdkRectangle imeBox = {0}; // No need to set width + GdkRectangle imeBox {}; imeBox.x = static_cast<gint>(pt.x); imeBox.y = static_cast<gint>(pt.y + std::max(4, vs.lineHeight/4)); // prevent overlapping with current line @@ -3011,7 +3013,7 @@ gboolean ScintillaGTK::IdleCallback(gpointer pSci) { // Idler will be automatically stopped, if there is nothing // to do while idle. const bool ret = sciThis->Idle(); - if (ret == false) { + if (!ret) { // FIXME: This will remove the idler from GTK, we don't want to // remove it as it is removed automatically when this function // returns false (although, it should be harmless). @@ -3047,9 +3049,7 @@ void ScintillaGTK::SetDocPointer(Document *document) { sciAccessible = ScintillaGTKAccessible::FromAccessible(accessible); if (sciAccessible && pdoc) { oldDoc = pdoc; - if (oldDoc) { - oldDoc->AddRef(); - } + oldDoc->AddRef(); } } Modified: scintilla/gtk/ScintillaGTK.h 3 lines changed, 2 insertions(+), 1 deletions(-) =================================================================== @@ -34,6 +34,7 @@ class ScintillaGTK : public ScintillaBase { int horizontalScrollBarHeight; SelectionText primary; + SelectionPosition posPrimary; GdkEvent *evbtn; guint buttonMouse; @@ -92,7 +93,7 @@ class ScintillaGTK : public ScintillaBase { ScintillaGTK(ScintillaGTK &&) = delete; ScintillaGTK &operator=(const ScintillaGTK &) = delete; ScintillaGTK &operator=(ScintillaGTK &&) = delete; - virtual ~ScintillaGTK(); + ~ScintillaGTK() override; static ScintillaGTK *FromWidget(GtkWidget *widget) noexcept; static void ClassInit(OBJECT_CLASS *object_class, GtkWidgetClass *widget_class, GtkContainerClass *container_class); private: Modified: scintilla/include/Scintilla.h 1 lines changed, 1 insertions(+), 0 deletions(-) =================================================================== @@ -907,6 +907,7 @@ typedef sptr_t (*SciFnDirectStatus)(sptr_t ptr, unsigned int iMessage, uptr_t wP #define CARETSTYLE_BLOCK 2 #define CARETSTYLE_OVERSTRIKE_BAR 0 #define CARETSTYLE_OVERSTRIKE_BLOCK 0x10 +#define CARETSTYLE_CURSES 0x20 #define CARETSTYLE_INS_MASK 0xF #define CARETSTYLE_BLOCK_AFTER 0x100 #define SCI_SETCARETSTYLE 2512 Modified: scintilla/include/Scintilla.iface 3 lines changed, 2 insertions(+), 1 deletions(-) =================================================================== @@ -2489,6 +2489,7 @@ val CARETSTYLE_LINE=1 val CARETSTYLE_BLOCK=2 val CARETSTYLE_OVERSTRIKE_BAR=0 val CARETSTYLE_OVERSTRIKE_BLOCK=0x10 +val CARETSTYLE_CURSES=0x20 val CARETSTYLE_INS_MASK=0xF val CARETSTYLE_BLOCK_AFTER=0x100 @@ -3127,7 +3128,7 @@ fun int DescribeKeyWordSets=4017(, stringresult descriptions) # Bit set of LineEndType enumertion for which line ends beyond the standard # LF, CR, and CRLF are supported by the lexer. -get int GetLineEndTypesSupported=4018(,) +get LineEndType GetLineEndTypesSupported=4018(,) # Allocate a set of sub styles for a particular base style, returning start of range fun int AllocateSubStyles=4020(int styleBase, int numberStyles) Modified: scintilla/include/ScintillaCall.h 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -854,7 +854,7 @@ class ScintillaCall { std::string DescribeProperty(const char *name); int DescribeKeyWordSets(char *descriptions); std::string DescribeKeyWordSets(); - int LineEndTypesSupported(); + Scintilla::LineEndType LineEndTypesSupported(); int AllocateSubStyles(int styleBase, int numberStyles); int SubStylesStart(int styleBase); int SubStylesLength(int styleBase); Modified: scintilla/include/ScintillaTypes.h 1 lines changed, 1 insertions(+), 0 deletions(-) =================================================================== @@ -439,6 +439,7 @@ enum class CaretStyle { Block = 2, OverstrikeBar = 0, OverstrikeBlock = 0x10, + Curses = 0x20, InsMask = 0xF, BlockAfter = 0x100, }; Modified: scintilla/lexilla/lexers/LexPython.cxx 21 lines changed, 11 insertions(+), 10 deletions(-) =================================================================== @@ -71,7 +71,7 @@ bool IsPyComment(Accessor &styler, Sci_Position pos, Sci_Position len) { return len > 0 && styler[pos] == '#'; } -bool IsPyStringTypeChar(int ch, literalsAllowed allowed) noexcept { +constexpr bool IsPyStringTypeChar(int ch, literalsAllowed allowed) noexcept { return ((allowed & litB) && (ch == 'b' || ch == 'B')) || ((allowed & litU) && (ch == 'u' || ch == 'U')) || @@ -93,17 +93,17 @@ bool IsPyStringStart(int ch, int chNext, int chNext2, literalsAllowed allowed) n return false; } -bool IsPyFStringState(int st) noexcept { +constexpr bool IsPyFStringState(int st) noexcept { return ((st == SCE_P_FCHARACTER) || (st == SCE_P_FSTRING) || (st == SCE_P_FTRIPLE) || (st == SCE_P_FTRIPLEDOUBLE)); } -bool IsPySingleQuoteStringState(int st) noexcept { +constexpr bool IsPySingleQuoteStringState(int st) noexcept { return ((st == SCE_P_CHARACTER) || (st == SCE_P_STRING) || (st == SCE_P_FCHARACTER) || (st == SCE_P_FSTRING)); } -bool IsPyTripleQuoteStringState(int st) noexcept { +constexpr bool IsPyTripleQuoteStringState(int st) noexcept { return ((st == SCE_P_TRIPLE) || (st == SCE_P_TRIPLEDOUBLE) || (st == SCE_P_FTRIPLE) || (st == SCE_P_FTRIPLEDOUBLE)); } @@ -232,7 +232,7 @@ struct OptionsPython { bool foldCompact; bool unicodeIdentifiers; - OptionsPython() { + OptionsPython() noexcept { whingeLevel = 0; base2or8Literals = true; stringsU = true; @@ -436,6 +436,8 @@ Sci_Position SCI_METHOD LexerPython::WordListSet(int n, const char *wl) { case 1: wordListN = &keywords2; break; + default: + break; } Sci_Position firstModification = -1; if (wordListN) { @@ -635,7 +637,7 @@ void SCI_METHOD LexerPython::Lex(Sci_PositionU startPos, Sci_Position length, in style = SCE_P_WORD2; } } else { - int subStyle = classifierIdentifiers.ValueFor(s); + const int subStyle = classifierIdentifiers.ValueFor(s); if (subStyle >= 0) { style = subStyle; } @@ -895,8 +897,8 @@ void SCI_METHOD LexerPython::Fold(Sci_PositionU startPos, Sci_Position length, i const int style = styler.StyleAt(lookAtPos) & 31; quote = options.foldQuotes && IsPyTripleQuoteStringState(style); } - const int quote_start = (quote && !prevQuote); - const int quote_continue = (quote && prevQuote); + const bool quote_start = (quote && !prevQuote); + const bool quote_continue = (quote && prevQuote); if (!quote || !prevQuote) indentCurrentLevel = indentCurrent & SC_FOLDLEVELNUMBERMASK; if (quote) @@ -921,8 +923,7 @@ void SCI_METHOD LexerPython::Fold(Sci_PositionU startPos, Sci_Position length, i int minCommentLevel = indentCurrentLevel; while (!quote && (lineNext < docLines) && - ((indentNext & SC_FOLDLEVELWHITEFLAG) || - (lineNext <= docLines && IsCommentLine(lineNext, styler)))) { + ((indentNext & SC_FOLDLEVELWHITEFLAG) || (IsCommentLine(lineNext, styler)))) { if (IsCommentLine(lineNext, styler) && indentNext < minCommentLevel) { minCommentLevel = indentNext; Modified: scintilla/lexilla/lexers/LexRust.cxx 12 lines changed, 5 insertions(+), 7 deletions(-) =================================================================== @@ -286,6 +286,8 @@ static void ScanNumber(Accessor& styler, Sci_Position& pos) { pos += 2; } else if (c == '6' && n == '4') { pos += 2; + } else if (styler.Match(pos, "128")) { + pos += 3; } else if (styler.Match(pos, "size")) { pos += 4; } else { @@ -524,7 +526,7 @@ static void ResumeBlockComment(Accessor &styler, Sci_Position& pos, Sci_Position level++; } } - else { + else if (pos < max) { pos++; } if (pos >= max) { @@ -557,12 +559,8 @@ static void ResumeLineComment(Accessor &styler, Sci_Position& pos, Sci_Position maybe_doc_comment = true; } - while (pos < max && c != '\n') { - if (pos == styler.LineEnd(styler.GetLine(pos))) - styler.SetLineState(styler.GetLine(pos), 0); - pos++; - c = styler.SafeGetCharAt(pos, '\0'); - } + pos = styler.LineEnd(styler.GetLine(pos)); + styler.SetLineState(styler.GetLine(pos), SCE_RUST_DEFAULT); if (state == DocComment || (state == UnknownComment && maybe_doc_comment)) styler.ColourTo(pos - 1, SCE_RUST_COMMENTLINEDOC); Modified: scintilla/lexilla/lexlib/Accessor.h 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -23,7 +23,7 @@ class Accessor : public LexAccessor { PropSetSimple *pprops; Accessor(Scintilla::IDocument *pAccess_, PropSetSimple *pprops_); int GetPropertyInt(std::string_view key, int defaultValue=0) const; - int IndentAmount(Sci_Position line, int *flags, PFNIsCommentLeader pfnIsCommentLeader = 0); + int IndentAmount(Sci_Position line, int *flags, PFNIsCommentLeader pfnIsCommentLeader = nullptr); }; } Modified: scintilla/lexilla/lexlib/LexerBase.cxx 6 lines changed, 3 insertions(+), 3 deletions(-) =================================================================== @@ -31,15 +31,15 @@ LexerBase::LexerBase(const LexicalClass *lexClasses_, size_t nClasses_) : lexClasses(lexClasses_), nClasses(nClasses_) { for (int wl = 0; wl < numWordLists; wl++) keyWordLists[wl] = new WordList; - keyWordLists[numWordLists] = 0; + keyWordLists[numWordLists] = nullptr; } LexerBase::~LexerBase() { for (int wl = 0; wl < numWordLists; wl++) { delete keyWordLists[wl]; - keyWordLists[wl] = 0; + keyWordLists[wl] = nullptr; } - keyWordLists[numWordLists] = 0; + keyWordLists[numWordLists] = nullptr; } void SCI_METHOD LexerBase::Release() { Modified: scintilla/lexilla/lexlib/WordList.cxx 8 lines changed, 4 insertions(+), 4 deletions(-) =================================================================== @@ -80,7 +80,7 @@ WordList::~WordList() { } WordList::operator bool() const noexcept { - return len ? true : false; + return len != 0; } bool WordList::operator!=(const WordList &other) const noexcept { @@ -144,7 +144,7 @@ bool WordList::Set(const char *s) { * so '^GTK_' matches 'GTK_X', 'GTK_MAJOR_VERSION', and 'GTK_'. */ bool WordList::InList(const char *s) const noexcept { - if (0 == words) + if (!words) return false; const unsigned char firstChar = s[0]; int j = starts[firstChar]; @@ -186,7 +186,7 @@ bool WordList::InList(const char *s) const noexcept { * The marker is ~ in this case. */ bool WordList::InListAbbreviated(const char *s, const char marker) const noexcept { - if (0 == words) + if (!words) return false; const unsigned char firstChar = s[0]; int j = starts[firstChar]; @@ -240,7 +240,7 @@ bool WordList::InListAbbreviated(const char *s, const char marker) const noexcep * No multiple markers check is done and wont work. */ bool WordList::InListAbridged(const char *s, const char marker) const noexcept { - if (0 == words) + if (!words) return false; const unsigned char firstChar = s[0]; int j = starts[firstChar]; Modified: scintilla/lexilla/version.txt 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -1 +1 @@ -512 +513 Modified: scintilla/src/CellBuffer.cxx 4 lines changed, 2 insertions(+), 2 deletions(-) =================================================================== @@ -37,7 +37,7 @@ struct CountWidths { // from the Base Multilingual Plane and those from other planes. Sci::Position countBasePlane; Sci::Position countOtherPlanes; - CountWidths(Sci::Position countBasePlane_=0, Sci::Position countOtherPlanes_=0) noexcept : + explicit CountWidths(Sci::Position countBasePlane_=0, Sci::Position countOtherPlanes_=0) noexcept : countBasePlane(countBasePlane_), countOtherPlanes(countOtherPlanes_) { } @@ -1286,7 +1286,7 @@ void CellBuffer::EndUndoAction() { } void CellBuffer::AddUndoAction(Sci::Position token, bool mayCoalesce) { - bool startSequence; + bool startSequence = false; uh.AppendAction(ActionType::container, token, nullptr, 0, startSequence, mayCoalesce); } Modified: scintilla/src/CharClassify.cxx 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -24,7 +24,7 @@ void CharClassify::SetDefaultCharClasses(bool includeWordClass) { for (int ch = 0; ch < maxChar; ch++) { if (ch == '\r' || ch == '\n') charClass[ch] = CharacterClass::newLine; - else if (ch < 0x20 || ch == ' ') + else if (IsControl(ch) || ch == ' ') charClass[ch] = CharacterClass::space; else if (includeWordClass && (ch >= 0x80 || IsAlphaNumeric(ch) || ch == '_')) charClass[ch] = CharacterClass::word; Modified: scintilla/src/CharacterType.h 84 lines changed, 57 insertions(+), 27 deletions(-) =================================================================== @@ -12,14 +12,33 @@ namespace Scintilla::Internal { // Functions for classifying characters +/** + * Check if a character is a space. + * This is ASCII specific but is safe with chars >= 0x80. + */ constexpr bool IsASpace(int ch) noexcept { return (ch == ' ') || ((ch >= 0x09) && (ch <= 0x0d)); } -constexpr bool IsASpaceOrTab(int ch) noexcept { +constexpr bool IsSpaceOrTab(int ch) noexcept { return (ch == ' ') || (ch == '\t'); } +constexpr bool IsControl(int ch) noexcept { + return ((ch >= 0) && (ch <= 0x1F)) || (ch == 0x7F); +} + +constexpr bool IsEOLCharacter(int ch) noexcept { + return ch == '\r' || ch == '\n'; +} + +constexpr bool IsBreakSpace(int ch) noexcept { + // used for text breaking, treat C0 control character as space. + // by default C0 control character is handled as special representation, + // so not appears in normal text. 0x7F DEL is omitted to simplify the code. + return ch >= 0 && ch <= ' '; +} + constexpr bool IsADigit(int ch) noexcept { return (ch >= '0') && (ch <= '9'); } @@ -57,33 +76,44 @@ constexpr bool IsAlphaNumeric(int ch) noexcept { ((ch >= 'A') && (ch <= 'Z')); } -/** - * Check if a character is a space. - * This is ASCII specific but is safe with chars >= 0x80. - */ -constexpr bool isspacechar(int ch) noexcept { - return (ch == ' ') || ((ch >= 0x09) && (ch <= 0x0d)); -} - -constexpr bool iswordchar(int ch) noexcept { - return IsAlphaNumeric(ch) || ch == '.' || ch == '_'; -} - -constexpr bool iswordstart(int ch) noexcept { - return IsAlphaNumeric(ch) || ch == '_'; -} - -constexpr bool isoperator(int ch) noexcept { - if (IsAlphaNumeric(ch)) - return false; - if (ch == '%' || ch == '^' || ch == '&' || ch == '*' || - ch == '(' || ch == ')' || ch == '-' || ch == '+' || - ch == '=' || ch == '|' || ch == '{' || ch == '}' || - ch == '[' || ch == ']' || ch == ':' || ch == ';' || - ch == '<' || ch == '>' || ch == ',' || ch == '/' || - ch == '?' || ch == '!' || ch == '.' || ch == '~') +constexpr bool IsPunctuation(int ch) noexcept { + switch (ch) { + case '!': + case '"': + case '#': + case '$': + case '%': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case ':': + case ';': + case '<': + case '=': + case '>': + case '?': + case '@': + case '[': + case '\\': + case ']': + case '^': + case '_': + case '`': + case '{': + case '|': + case '}': + case '~': return true; - return false; + default: + return false; + } } // Simple case functions for ASCII supersets. Modified: scintilla/src/ContractionState.cxx 4 lines changed, 1 insertions(+), 3 deletions(-) =================================================================== @@ -95,9 +95,7 @@ ContractionState<LINE>::ContractionState() noexcept : linesInDocument(1) { } template <typename LINE> -ContractionState<LINE>::~ContractionState() { - Clear(); -} +ContractionState<LINE>::~ContractionState() = default; template <typename LINE> void ContractionState<LINE>::EnsureData() { Modified: scintilla/src/Document.cxx 188 lines changed, 82 insertions(+), 106 deletions(-) =================================================================== @@ -1127,53 +1127,74 @@ bool Document::IsDBCSDualByteAt(Sci::Position pos) const noexcept { && IsDBCSTrailByteNoExcept(cb.CharAt(pos + 1)); } -static constexpr bool IsSpaceOrTab(int ch) noexcept { - return ch == ' ' || ch == '\t'; -} - -// Need to break text into segments near lengthSegment but taking into -// account the encoding to not break inside a UTF-8 or DBCS character -// and also trying to avoid breaking inside a pair of combining characters. +// Need to break text into segments near end but taking into account the +// encoding to not break inside a UTF-8 or DBCS character and also trying +// to avoid breaking inside a pair of combining characters, or inside +// ligatures. +// TODO: implement grapheme cluster boundaries, +// see
https://www.unicode.org/reports/tr29/#Grapheme_Cluster_Boundaries
. +// // The segment length must always be long enough (more than 4 bytes) // so that there will be at least one whole character to make a segment. // For UTF-8, text must consist only of valid whole characters. // In preference order from best to worst: -// 1) Break after space -// 2) Break before punctuation -// 3) Break after whole character - -int Document::SafeSegment(const char *text, int length, int lengthSegment) const noexcept { - if (length <= lengthSegment) - return length; - int lastSpaceBreak = -1; - int lastPunctuationBreak = -1; - int lastEncodingAllowedBreak = 0; - for (int j=0; j < lengthSegment;) { - const unsigned char ch = text[j]; - if (j > 0) { - if (IsSpaceOrTab(text[j - 1]) && !IsSpaceOrTab(text[j])) { - lastSpaceBreak = j; +// 1) Break before or after spaces or controls +// 2) Break at word and punctuation boundary for better kerning and ligature support +// 3) Break after whole character, this may break combining characters + +size_t Document::SafeSegment(std::string_view text) const noexcept { + // check space first as most written language use spaces. + for (std::string_view::iterator it = text.end() - 1; it != text.begin(); --it) { + if (IsBreakSpace(*it)) { + return it - text.begin(); + } + } + + if (!dbcsCodePage || dbcsCodePage == CpUtf8) { + // backward iterate for UTF-8 and single byte encoding to find word and punctuation boundary. + std::string_view::iterator it = text.end() - 1; + const bool punctuation = IsPunctuation(*it); + do { + --it; + if (punctuation != IsPunctuation(*it)) { + return it - text.begin() + 1; } - if (ch < 'A') { - lastPunctuationBreak = j; + } while (it != text.begin()); + + it = text.end() - 1; + if (dbcsCodePage) { + // for UTF-8 go back to the start of last character. + for (int trail = 0; trail < UTF8MaxBytes - 1 && UTF8IsTrailByte(*it); trail++) { + --it; } } - lastEncodingAllowedBreak = j; + return it - text.begin(); + } - if (dbcsCodePage == CpUtf8) { - j += UTF8BytesOfLead[ch]; - } else if (dbcsCodePage) { - j += IsDBCSLeadByteNoExcept(ch) ? 2 : 1; - } else { - j++; + { + // forward iterate for DBCS to find word and punctuation boundary. + size_t lastPunctuationBreak = 0; + size_t lastEncodingAllowedBreak = 0; + CharacterClass ccPrev = CharacterClass::space; + for (size_t j = 0; j < text.length();) { + const unsigned char ch = text[j]; + lastEncodingAllowedBreak = j++; + + CharacterClass cc = CharacterClass::word; + if (UTF8IsAscii(ch)) { + if (IsPunctuation(ch)) { + cc = CharacterClass::punctuation; + } + } else { + j += IsDBCSLeadByteNoExcept(ch); + } + if (cc != ccPrev) { + ccPrev = cc; + lastPunctuationBreak = lastEncodingAllowedBreak; + } } + return lastPunctuationBreak ? lastPunctuationBreak : lastEncodingAllowedBreak; } - if (lastSpaceBreak >= 0) { - return lastSpaceBreak; - } else if (lastPunctuationBreak >= 0) { - return lastPunctuationBreak; - } - return lastEncodingAllowedBreak; } EncodingFamily Document::CodePageFamily() const noexcept { @@ -1218,7 +1239,7 @@ bool Document::DeleteChars(Sci::Position pos, Sci::Position len) { DocModification( ModificationFlags::BeforeDelete | ModificationFlags::User, pos, len, - 0, 0)); + 0, nullptr)); const Sci::Line prevLinesTotal = LinesTotal(); const bool startSavePoint = cb.IsSavePoint(); bool startSequence = false; @@ -2419,7 +2440,7 @@ Sci::Line Document::GetMaxLineState() const noexcept { void SCI_METHOD Document::ChangeLexerState(Sci_Position start, Sci_Position end) { const DocModification mh(ModificationFlags::LexerState, start, - end-start, 0, 0, 0); + end-start, 0, nullptr, 0); NotifyModified(mh); } @@ -2432,20 +2453,20 @@ StyledText Document::MarginStyledText(Sci::Line line) const noexcept { void Document::MarginSetText(Sci::Line line, const char *text) { Margins()->SetText(line, text); const DocModification mh(ModificationFlags::ChangeMargin, LineStart(line), - 0, 0, 0, line); + 0, 0, nullptr, line); NotifyModified(mh); } void Document::MarginSetStyle(Sci::Line line, int style) { Margins()->SetStyle(line, style); NotifyModified(DocModification(ModificationFlags::ChangeMargin, LineStart(line), - 0, 0, 0, line)); + 0, 0, nullptr, line)); } void Document::MarginSetStyles(Sci::Line line, const unsigned char *styles) { Margins()->SetStyles(line, styles); NotifyModified(DocModification(ModificationFlags::ChangeMargin, LineStart(line), - 0, 0, 0, line)); + 0, 0, nullptr, line)); } void Document::MarginClearAll() { @@ -2468,7 +2489,7 @@ void Document::AnnotationSetText(Sci::Line line, const char *text) { Annotations()->SetText(line, text); const int linesAfter = AnnotationLines(line); DocModification mh(ModificationFlags::ChangeAnnotation, LineStart(line), - 0, 0, 0, line); + 0, 0, nullptr, line); mh.annotationLinesAdded = linesAfter - linesBefore; NotifyModified(mh); } @@ -2478,7 +2499,7 @@ void Document::AnnotationSetStyle(Sci::Line line, int style) { if (line >= 0 && line < LinesTotal()) { Annotations()->SetStyle(line, style); const DocModification mh(ModificationFlags::ChangeAnnotation, LineStart(line), - 0, 0, 0, line); + 0, 0, nullptr, line); NotifyModified(mh); } } @@ -2511,7 +2532,7 @@ void Document::EOLAnnotationSetText(Sci::Line line, const char *text) { if (line >= 0 && line < LinesTotal()) { EOLAnnotations()->SetText(line, text); const DocModification mh(ModificationFlags::ChangeEOLAnnotation, LineStart(line), - 0, 0, 0, line); + 0, 0, nullptr, line); NotifyModified(mh); } } @@ -2520,7 +2541,7 @@ void Document::EOLAnnotationSetStyle(Sci::Line line, int style) { if (line >= 0 && line < LinesTotal()) { EOLAnnotations()->SetStyle(line, style); const DocModification mh(ModificationFlags::ChangeEOLAnnotation, LineStart(line), - 0, 0, 0, line); + 0, 0, nullptr, line); NotifyModified(mh); } } @@ -2600,49 +2621,8 @@ void Document::NotifyModified(DocModification mh) { } } -// Used for word part navigation. -static bool IsASCIIPunctuationCharacter(unsigned int ch) noexcept { - switch (ch) { - case '!': - case '"': - case '#': - case '$': - case '%': - case '&': - case '\'': - case '(': - case ')': - case '*': - case '+': - case ',': - case '-': - case '.': - case '/': - case ':': - case ';': - case '<': - case '=': - case '>': - case '?': - case '@': - case '[': - case '\\': - case ']': - case '^': - case '_': - case '`': - case '{': - case '|': - case '}': - case '~': - return true; - default: - return false; - } -} - bool Document::IsWordPartSeparator(unsigned int ch) const { - return (WordCharacterClass(ch) == CharacterClass::word) && IsASCIIPunctuationCharacter(ch); + return (WordCharacterClass(ch) == CharacterClass::word) && IsPunctuation(ch); } Sci::Position Document::WordPartLeft(Sci::Position pos) const { @@ -2672,15 +2652,15 @@ Sci::Position Document::WordPartLeft(Sci::Position pos) const { pos -= CharacterBefore(pos).widthBytes; if (!IsADigit(CharacterAfter(pos).character)) pos += CharacterAfter(pos).widthBytes; - } else if (IsASCIIPunctuationCharacter(ceStart.character)) { - while (pos > 0 && IsASCIIPunctuationCharacter(CharacterAfter(pos).character)) + } else if (IsPunctuation(ceStart.character)) { + while (pos > 0 && IsPunctuation(CharacterAfter(pos).character)) pos -= CharacterBefore(pos).widthBytes; - if (!IsASCIIPunctuationCharacter(CharacterAfter(pos).character)) + if (!IsPunctuation(CharacterAfter(pos).character)) pos += CharacterAfter(pos).widthBytes; - } else if (isspacechar(ceStart.character)) { - while (pos > 0 && isspacechar(CharacterAfter(pos).character)) + } else if (IsASpace(ceStart.character)) { + while (pos > 0 && IsASpace(CharacterAfter(pos).character)) pos -= CharacterBefore(pos).widthBytes; - if (!isspacechar(CharacterAfter(pos).character)) + if (!IsASpace(CharacterAfter(pos).character)) pos += CharacterAfter(pos).widthBytes; } else if (!IsASCII(ceStart.character)) { while (pos > 0 && !IsASCII(CharacterAfter(pos).character)) @@ -2723,30 +2703,26 @@ Sci::Position Document::WordPartRight(Sci::Position pos) const { } else if (IsADigit(ceStart.character)) { while (pos < length && IsADigit(CharacterAfter(pos).character)) pos += CharacterAfter(pos).widthBytes; - } else if (IsASCIIPunctuationCharacter(ceStart.character)) { - while (pos < length && IsASCIIPunctuationCharacter(CharacterAfter(pos).character)) + } else if (IsPunctuation(ceStart.character)) { + while (pos < length && IsPunctuation(CharacterAfter(pos).character)) pos += CharacterAfter(pos).widthBytes; - } else if (isspacechar(ceStart.character)) { - while (pos < length && isspacechar(CharacterAfter(pos).character)) + } else if (IsASpace(ceStart.character)) { + while (pos < length && IsASpace(CharacterAfter(pos).character)) pos += CharacterAfter(pos).widthBytes; } else { pos += CharacterAfter(pos).widthBytes; } return pos; } -static constexpr bool IsLineEndChar(char c) noexcept { - return (c == '\n' || c == '\r'); -} - Sci::Position Document::ExtendStyleRange(Sci::Position pos, int delta, bool singleLine) noexcept { - const int sStart = cb.StyleAt(pos); + const char sStart = cb.StyleAt(pos); if (delta < 0) { - while (pos > 0 && (cb.StyleAt(pos) == sStart) && (!singleLine || !IsLineEndChar(cb.CharAt(pos)))) + while (pos > 0 && (cb.StyleAt(pos) == sStart) && (!singleLine || !IsEOLCharacter(cb.CharAt(pos)))) pos--; pos++; } else { - while (pos < (LengthNoExcept()) && (cb.StyleAt(pos) == sStart) && (!singleLine || !IsLineEndChar(cb.CharAt(pos)))) + while (pos < (LengthNoExcept()) && (cb.StyleAt(pos) == sStart) && (!singleLine || !IsEOLCharacter(cb.CharAt(pos)))) pos++; } return pos; @@ -2986,7 +2962,7 @@ class UTF8Iterator { typedef wchar_t* pointer; typedef wchar_t& reference; - UTF8Iterator(const Document *doc_=nullptr, Sci::Position position_=0) noexcept : + explicit UTF8Iterator(const Document *doc_=nullptr, Sci::Position position_=0) noexcept : doc(doc_), position(position_), characterIndex(0), lenBytes(0), lenCharacters(0), buffered{} { buffered[0] = 0; buffered[1] = 0; Modified: scintilla/src/Document.h 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -352,7 +352,7 @@ class Document : PerLine, public Scintilla::IDocument, public Scintilla::ILoader bool IsDBCSTrailByteNoExcept(char ch) const noexcept; int DBCSDrawBytes(std::string_view text) const noexcept; bool IsDBCSDualByteAt(Sci::Position pos) const noexcept; - int SafeSegment(const char *text, int length, int lengthSegment) const noexcept; + size_t SafeSegment(std::string_view text) const noexcept; EncodingFamily CodePageFamily() const noexcept; // Gateways to modifying document Modified: scintilla/src/EditView.cxx 107 lines changed, 66 insertions(+), 41 deletions(-) =================================================================== @@ -368,12 +368,6 @@ inline char CaseForce(Style::CaseForce caseForce, char chDoc, char chPrevious) n } } -constexpr bool IsControlCharacter(int ch) noexcept { - // iscntrl returns true for lots of chars > 127 which are displayable, - // currently only check C0 control characters. - return (ch >= 0 && ch < ' ') || (ch == 127); -} - bool ViewIsASCII(std::string_view text) { return std::all_of(text.cbegin(), text.cend(), IsASCII); } @@ -470,7 +464,7 @@ void EditView::LayoutLine(const EditModel &model, Surface *surface, const ViewSt ll->positions[0] = 0; bool lastSegItalics = false; - BreakFinder bfLayout(ll, nullptr, Range(0, numCharsInLine), posLineStart, 0, false, model.pdoc, &model.reprs, nullptr); + BreakFinder bfLayout(ll, nullptr, Range(0, numCharsInLine), posLineStart, 0, BreakFinder::BreakFor::Text, model.pdoc, &model.reprs, nullptr); while (bfLayout.More()) { const TextSegment ts = bfLayout.Next(); @@ -570,46 +564,55 @@ void EditView::LayoutLine(const EditModel &model, Surface *surface, const ViewSt ll->wrapIndent = vstyle.aveCharWidth; // Indent to show start visual ll->lines = 0; // Calculate line start positions based upon width. - Sci::Position lastGoodBreak = 0; Sci::Position lastLineStart = 0; - XYACCUMULATOR startOffset = 0; + XYACCUMULATOR startOffset = width; Sci::Position p = 0; - while (p < ll->numCharsInLine) { - if ((ll->positions[p + 1] - startOffset) >= width) { + const Wrap wrapState = vstyle.wrap.state; + const Sci::Position numCharsInLine = ll->numCharsInLine; + while (p < numCharsInLine) { + while (p < numCharsInLine && ll->positions[p + 1] < startOffset) { + p++; + } + if (p < numCharsInLine) { + // backtrack to find lastGoodBreak + Sci::Position lastGoodBreak = p; + if (p > 0) { + lastGoodBreak = model.pdoc->MovePositionOutsideChar(p + posLineStart, -1) - posLineStart; + } + if (wrapState != Wrap::Char) { + Sci::Position pos = lastGoodBreak; + while (pos > lastLineStart) { + // style boundary and space + if (wrapState != Wrap::WhiteSpace && (ll->styles[pos - 1] != ll->styles[pos])) { + break; + } + if (IsBreakSpace(ll->chars[pos - 1]) && !IsBreakSpace(ll->chars[pos])) { + break; + } + pos = model.pdoc->MovePositionOutsideChar(pos + posLineStart - 1, -1) - posLineStart; + } + if (pos > lastLineStart) { + lastGoodBreak = pos; + } + } if (lastGoodBreak == lastLineStart) { // Try moving to start of last character if (p > 0) { - lastGoodBreak = model.pdoc->MovePositionOutsideChar(p + posLineStart, -1) - - posLineStart; + lastGoodBreak = model.pdoc->MovePositionOutsideChar(p + posLineStart, -1) - posLineStart; } if (lastGoodBreak == lastLineStart) { // Ensure at least one character on line. - lastGoodBreak = model.pdoc->MovePositionOutsideChar(lastGoodBreak + posLineStart + 1, 1) - - posLineStart; + lastGoodBreak = model.pdoc->MovePositionOutsideChar(lastGoodBreak + posLineStart + 1, 1) - posLineStart; } } lastLineStart = lastGoodBreak; ll->lines++; - ll->SetLineStart(ll->lines, static_cast<int>(lastGoodBreak)); - startOffset = ll->positions[lastGoodBreak]; + ll->SetLineStart(ll->lines, static_cast<int>(lastLineStart)); + startOffset = ll->positions[lastLineStart]; // take into account the space for start wrap mark and indent - startOffset -= ll->wrapIndent; - p = lastGoodBreak + 1; - continue; - } - if (p > 0) { - if (vstyle.wrap.state == Wrap::Char) { - lastGoodBreak = model.pdoc->MovePositionOutsideChar(p + posLineStart, -1) - - posLineStart; - p = model.pdoc->MovePositionOutsideChar(p + 1 + posLineStart, 1) - posLineStart; - continue; - } else if ((vstyle.wrap.state == Wrap::Word) && (ll->styles[p] != ll->styles[p - 1])) { - lastGoodBreak = p; - } else if (IsSpaceOrTab(ll->chars[p - 1]) && !IsSpaceOrTab(ll->chars[p])) { - lastGoodBreak = p; - } + startOffset += width - ll->wrapIndent; + p = lastLineStart + 1; } - p++; } ll->lines++; } @@ -1636,7 +1639,7 @@ void EditView::DrawCarets(Surface *surface, const EditModel &model, const ViewSt } const bool caretBlinkState = (model.caret.active && model.caret.on) || (!additionalCaretsBlink && !mainCaret); const bool caretVisibleState = additionalCaretsVisible || mainCaret; - if ((xposCaret >= 0) && vsDraw.IsCaretVisible() && + if ((xposCaret >= 0) && vsDraw.IsCaretVisible(mainCaret) && (drawDrag || (caretBlinkState && caretVisibleState))) { bool canDrawBlockCaret = true; bool drawBlockCaret = false; @@ -1660,7 +1663,8 @@ void EditView::DrawCarets(Surface *surface, const EditModel &model, const ViewSt if (xposCaret > 0) caretWidthOffset = 0.51f; // Move back so overlaps both character cells. xposCaret += xStart; - const ViewStyle::CaretShape caretShape = drawDrag ? ViewStyle::CaretShape::line : vsDraw.CaretShapeForMode(model.inOverstrike); + const ViewStyle::CaretShape caretShape = drawDrag ? ViewStyle::CaretShape::line : + vsDraw.CaretShapeForMode(model.inOverstrike, mainCaret); if (drawDrag) { /* Dragging text, use a line caret */ rcCaret.left = std::round(xposCaret - caretWidthOffset); @@ -1673,7 +1677,7 @@ void EditView::DrawCarets(Surface *surface, const EditModel &model, const ViewSt } else if ((caretShape == ViewStyle::CaretShape::block) || imeCaretBlockOverride) { /* Block caret */ rcCaret.left = xposCaret; - if (canDrawBlockCaret && !(IsControlCharacter(ll->chars[offset]))) { + if (canDrawBlockCaret && !(IsControl(ll->chars[offset]))) { drawBlockCaret = true; rcCaret.right = xposCaret + widthOverstrikeCaret; } else { @@ -1733,6 +1737,21 @@ static void DrawWrapIndentAndMarker(Surface *surface, const ViewStyle &vsDraw, c } } +// On the curses platform, the terminal is drawing its own caret, so if the caret is within +// the main selection, do not draw the selection at that position. +// Use iDoc from DrawBackground and DrawForeground here because TextSegment has been adjusted +// such that, if the caret is inside the main selection, the beginning or end of that selection +// is at the end of a text segment. +// This function should only be called if iDoc is within the main selection. +static InSelection CharacterInCursesSelection(Sci::Position iDoc, const EditModel &model, const ViewStyle &vsDraw) { + const SelectionPosition &posCaret = model.sel.RangeMain().caret; + const bool caretAtStart = posCaret < model.sel.RangeMain().anchor && posCaret.Position() == iDoc; + const bool caretAtEnd = posCaret > model.sel.RangeMain().anchor && + vsDraw.DrawCaretInsideSelection(false, false) && + model.pdoc->MovePositionOutsideChar(posCaret.Position() - 1, -1) == iDoc; + return (caretAtStart || caretAtEnd) ? InSelection::inNone : InSelection::inMain; +} + void EditView::DrawBackground(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, PRectangle rcLine, Range lineRange, Sci::Position posLineStart, int xStart, int subLine, std::optional<ColourRGBA> background) const { @@ -1743,7 +1762,8 @@ void EditView::DrawBackground(Surface *surface, const EditModel &model, const Vi // Does not take margin into account but not significant const XYPOSITION xStartVisible = static_cast<XYPOSITION>(subLineStart-xStart); - BreakFinder bfBack(ll, &model.sel, lineRange, posLineStart, xStartVisible, selBackDrawn, model.pdoc, &model.reprs, nullptr); + const BreakFinder::BreakFor breakFor = selBackDrawn ? BreakFinder::BreakFor::Selection : BreakFinder::BreakFor::Text; + BreakFinder bfBack(ll, &model.sel, lineRange, posLineStart, xStartVisible, breakFor, model.pdoc, &model.reprs, &vsDraw); const bool drawWhitespaceBackground = vsDraw.WhitespaceBackgroundDrawn() && !background; @@ -1766,7 +1786,9 @@ void EditView::DrawBackground(Surface *surface, const EditModel &model, const Vi if (rcSegment.right > rcLine.right) rcSegment.right = rcLine.right; - const InSelection inSelection = hideSelection ? InSelection::inNone : model.sel.CharacterInSelection(iDoc); + InSelection inSelection = hideSelection ? InSelection::inNone : model.sel.CharacterInSelection(iDoc); + if (FlagSet(vsDraw.caret.style, CaretStyle::Curses) && (inSelection == InSelection::inMain)) + inSelection = CharacterInCursesSelection(iDoc, model, vsDraw); const bool inHotspot = model.hotspot.Valid() && model.hotspot.ContainsCharacter(iDoc); ColourRGBA textBack = TextBackground(model, vsDraw, ll, background, inSelection, inHotspot, ll->styles[i], i); @@ -1959,8 +1981,9 @@ void EditView::DrawForeground(Surface *surface, const EditModel &model, const Vi const XYPOSITION xStartVisible = static_cast<XYPOSITION>(subLineStart-xStart); // Foreground drawing loop - BreakFinder bfFore(ll, &model.sel, lineRange, posLineStart, xStartVisible, - (((phasesDraw == PhasesDraw::One) && selBackDrawn) || vsDraw.SelectionTextDrawn()), model.pdoc, &model.reprs, &vsDraw); + const BreakFinder::BreakFor breakFor = (((phasesDraw == PhasesDraw::One) && selBackDrawn) || vsDraw.SelectionTextDrawn()) + ? BreakFinder::BreakFor::ForegroundAndSelection : BreakFinder::BreakFor::Foreground; + BreakFinder bfFore(ll, &model.sel, lineRange, posLineStart, xStartVisible, breakFor, model.pdoc, &model.reprs, &vsDraw); while (bfFore.More()) { @@ -2010,7 +2033,9 @@ void EditView::DrawForeground(Surface *surface, const EditModel &model, const Vi } } } - const InSelection inSelection = hideSelection ? InSelection::inNone : model.sel.CharacterInSelection(iDoc); + InSelection inSelection = hideSelection ? InSelection::inNone : model.sel.CharacterInSelection(iDoc); + if (FlagSet(vsDraw.caret.style, CaretStyle::Curses) && (inSelection == InSelection::inMain)) + inSelection = CharacterInCursesSelection(iDoc, model, vsDraw); const std::optional<ColourRGBA> selectionFore = SelectionForeground(model, vsDraw, inSelection); if (selectionFore) { textFore = *selectionFore; Modified: scintilla/src/Editor.cxx 12 lines changed, 6 insertions(+), 6 deletions(-) =================================================================== @@ -772,9 +772,9 @@ void Editor::MultipleSelectAdd(AddNumber addNumber) { searchRanges.push_back(rangeTarget); } - for (std::vector<Range>::const_iterator it = searchRanges.begin(); it != searchRanges.end(); ++it) { - Sci::Position searchStart = it->start; - const Sci::Position searchEnd = it->end; + for (const Range range : searchRanges) { + Sci::Position searchStart = range.start; + const Sci::Position searchEnd = range.end; for (;;) { Sci::Position lengthFound = selectedText.length(); const Sci::Position pos = pdoc->FindText(searchStart, searchEnd, @@ -2193,10 +2193,10 @@ void Editor::PasteRectangular(SelectionPosition pos, const char *ptr, Sci::Posit sel.RangeMain().caret = RealizeVirtualSpace(sel.RangeMain().caret); const int xInsert = XFromPosition(sel.RangeMain().caret); bool prevCr = false; - while ((len > 0) && IsEOLChar(ptr[len-1])) + while ((len > 0) && IsEOLCharacter(ptr[len-1])) len--; for (Sci::Position i = 0; i < len; i++) { - if (IsEOLChar(ptr[i])) { + if (IsEOLCharacter(ptr[i])) { if ((ptr[i] == '\r') || (!prevCr)) line++; if (line >= pdoc->LinesTotal()) { @@ -7592,7 +7592,7 @@ sptr_t Editor::WndProc(Message iMessage, uptr_t wParam, sptr_t lParam) { return vs.ElementColour(Element::Caret)->OpaqueRGB(); case Message::SetCaretStyle: - if (static_cast<CaretStyle>(wParam) <= (CaretStyle::Block | CaretStyle::OverstrikeBlock | CaretStyle::BlockAfter)) + if (static_cast<CaretStyle>(wParam) <= (CaretStyle::Block | CaretStyle::OverstrikeBlock | CaretStyle::Curses | CaretStyle::BlockAfter)) vs.caret.style = static_cast<CaretStyle>(wParam); else /* Default to the line caret */ Modified: scintilla/src/KeyMap.cxx 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -67,7 +67,7 @@ const std::map<KeyModifiers, Message> &KeyMap::GetKeyMap() const noexcept { namespace { -constexpr Keys Key(char ch) { +constexpr Keys Key(char ch) noexcept { return static_cast<Keys>(ch); } Modified: scintilla/src/MarginView.cxx 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -87,7 +87,7 @@ void DrawWrapMarker(Surface *surface, PRectangle rcPlace, XYPOSITION yBase; int yDir; XYPOSITION halfWidth; - Point At(XYPOSITION xRelative, XYPOSITION yRelative) noexcept { + Point At(XYPOSITION xRelative, XYPOSITION yRelative) const noexcept { return Point(xBase + xDir * xRelative + halfWidth, yBase + yDir * yRelative + halfWidth); } }; Modified: scintilla/src/MarginView.h 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -36,7 +36,7 @@ class MarginView { void DropGraphics() noexcept; void RefreshPixMaps(Surface *surfaceWindow, const ViewStyle &vsDraw); - void PaintOneMargin(Surface *surface, PRectangle rc, PRectangle rcMargin, const MarginStyle &marginStyle, + void PaintOneMargin(Surface *surface, PRectangle rc, PRectangle rcOneMargin, const MarginStyle &marginStyle, const EditModel &model, const ViewStyle &vs); void PaintMargin(Surface *surface, Sci::Line topLine, PRectangle rc, PRectangle rcMargin, const EditModel &model, const ViewStyle &vs); Modified: scintilla/src/PerLine.cxx 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -102,7 +102,7 @@ void LineMarkers::Init() { void LineMarkers::InsertLine(Sci::Line line) { if (markers.Length()) { - markers.Insert(line, 0); + markers.Insert(line, nullptr); } } Modified: scintilla/src/PositionCache.cxx 98 lines changed, 55 insertions(+), 43 deletions(-) =================================================================== @@ -31,6 +31,7 @@ #include "Geometry.h" #include "Platform.h" +#include "CharacterType.h" #include "CharacterCategoryMap.h" #include "Position.h" #include "UniqueString.h" @@ -547,10 +548,8 @@ namespace { constexpr unsigned int KeyFromString(std::string_view charBytes) noexcept { PLATFORM_ASSERT(charBytes.length() <= 4); unsigned int k=0; - for (size_t i=0; i < charBytes.length(); i++) { - k = k * 0x100; - const unsigned char uc = charBytes[i]; - k += uc; + for (const unsigned char uc : charBytes) { + k = k * 0x100 + uc; } return k; } @@ -562,16 +561,18 @@ constexpr unsigned int representationKeyCrLf = KeyFromString("\r\n"); void SpecialRepresentations::SetRepresentation(std::string_view charBytes, std::string_view value) { if ((charBytes.length() <= 4) && (value.length() <= Representation::maxLength)) { const unsigned int key = KeyFromString(charBytes); - const MapRepresentation::iterator it = mapReprs.find(key); - if (it == mapReprs.end()) { + const bool inserted = mapReprs.insert_or_assign(key, Representation(value)).second; + if (inserted) { // New entry so increment for first byte const unsigned char ucStart = charBytes.empty() ? 0 : charBytes[0]; startByteHasReprs[ucStart]++; + if (key > maxKey) { + maxKey = key; + } if (key == representationKeyCrLf) { crlf = true; } } - mapReprs[key] = Representation(value); } } @@ -608,6 +609,9 @@ void SpecialRepresentations::ClearRepresentation(std::string_view charBytes) { mapReprs.erase(it); const unsigned char ucStart = charBytes.empty() ? 0 : charBytes[0]; startByteHasReprs[ucStart]--; + if (key == maxKey && startByteHasReprs[ucStart] == 0) { + maxKey = mapReprs.empty() ? 0 : mapReprs.crbegin()->first; + } if (key == representationKeyCrLf) { crlf = false; } @@ -616,7 +620,11 @@ void SpecialRepresentations::ClearRepresentation(std::string_view charBytes) { } const Representation *SpecialRepresentations::GetRepresentation(std::string_view charBytes) const { - const MapRepresentation::const_iterator it = mapReprs.find(KeyFromString(charBytes)); + const unsigned int key = KeyFromString(charBytes); + if (key > maxKey) { + return nullptr; + } + const MapRepresentation::const_iterator it = mapReprs.find(key); if (it != mapReprs.end()) { return &(it->second); } @@ -633,19 +641,11 @@ const Representation *SpecialRepresentations::RepresentationFromCharacter(std::s return nullptr; } -bool SpecialRepresentations::Contains(std::string_view charBytes) const { - PLATFORM_ASSERT(charBytes.length() <= 4); - const unsigned char ucStart = charBytes.empty() ? 0 : charBytes[0]; - if (!startByteHasReprs[ucStart]) - return false; - const MapRepresentation::const_iterator it = mapReprs.find(KeyFromString(charBytes)); - return it != mapReprs.end(); -} - void SpecialRepresentations::Clear() { mapReprs.clear(); - constexpr short none = 0; + constexpr unsigned short none = 0; std::fill(startByteHasReprs, std::end(startByteHasReprs), none); + maxKey = 0; crlf = false; } @@ -662,7 +662,7 @@ void BreakFinder::Insert(Sci::Position val) { } BreakFinder::BreakFinder(const LineLayout *ll_, const Selection *psel, Range lineRange_, Sci::Position posLineStart_, - XYPOSITION xStart, bool breakForSelection, const Document *pdoc_, const SpecialRepresentations *preprs_, const ViewStyle *pvsDraw) : + XYPOSITION xStart, BreakFor breakFor, const Document *pdoc_, const SpecialRepresentations *preprs_, const ViewStyle *pvsDraw) : ll(ll_), lineRange(lineRange_), posLineStart(posLineStart_), @@ -683,7 +683,7 @@ BreakFinder::BreakFinder(const LineLayout *ll_, const Selection *psel, Range lin nextBreak--; } - if (breakForSelection) { + if (FlagSet(breakFor, BreakFor::Selection)) { const SelectionPosition posStart(posLineStart); const SelectionPosition posEnd(posLineStart + lineRange.end); const SelectionSegment segmentLine(posStart, posEnd); @@ -696,8 +696,23 @@ BreakFinder::BreakFinder(const LineLayout *ll_, const Selection *psel, Range lin Insert(portion.end.Position() - posLineStart); } } + // On the curses platform, the terminal is drawing its own caret, so add breaks around the + // caret in the main selection in order to help prevent the selection from being drawn in + // the caret's cell. + if (FlagSet(pvsDraw->caret.style, CaretStyle::Curses) && !psel->RangeMain().Empty()) { + const Sci::Position caretPos = psel->RangeMain().caret.Position(); + const Sci::Position anchorPos = psel->RangeMain().anchor.Position(); + if (caretPos < anchorPos) { + const Sci::Position nextPos = pdoc->MovePositionOutsideChar(caretPos + 1, 1); + Insert(nextPos - posLineStart); + } else if (caretPos > anchorPos && pvsDraw->DrawCaretInsideSelection(false, false)) { + const Sci::Position prevPos = pdoc->MovePositionOutsideChar(caretPos - 1, -1); + if (prevPos > anchorPos) + Insert(prevPos - posLineStart); + } + } } - if (pvsDraw && pvsDraw->indicatorsSetFore) { + if (FlagSet(breakFor, BreakFor::Foreground) && pvsDraw->indicatorsSetFore) { for (const IDecoration *deco : pdoc->decorations->View()) { if (pvsDraw->indicators[deco->Indicator()].OverridesTextFore()) { Sci::Position startPos = deco->EndRun(posLineStart); @@ -713,12 +728,12 @@ BreakFinder::BreakFinder(const LineLayout *ll_, const Selection *psel, Range lin saeNext = (!selAndEdge.empty()) ? selAndEdge[0] : -1; } -BreakFinder::~BreakFinder() { -} +BreakFinder::~BreakFinder() noexcept = default; TextSegment BreakFinder::Next() { - if (subBreak == -1) { + if (subBreak < 0) { const int prev = nextBreak; + const Representation *repr = nullptr; while (nextBreak < lineRange.end) { int charWidth = 1; const char * const chars = &ll->chars[nextBreak]; @@ -730,7 +745,7 @@ TextSegment BreakFinder::Next() { charWidth = pdoc->DBCSDrawBytes(std::string_view(chars, lineRange.end - nextBreak)); } } - const Representation *repr = nullptr; + repr = nullptr; if (preprs->MayContain(ch)) { // Special case \r\n line ends if there is a representation if (ch == '\r' && preprs->ContainsCrLf() && chars[1] == '\n') { @@ -752,35 +767,32 @@ TextSegment BreakFinder::Next() { } else { repr = nullptr; // Optimize -> should remember repr } - if ((nextBreak - prev) < lengthStartSubdivision) { - return TextSegment(prev, nextBreak - prev, repr); - } else { - break; - } + break; } } nextBreak += charWidth; } - if ((nextBreak - prev) < lengthStartSubdivision) { - return TextSegment(prev, nextBreak - prev); + + const int lengthSegment = nextBreak - prev; + if (lengthSegment < lengthStartSubdivision) { + return TextSegment(prev, lengthSegment, repr); } subBreak = prev; } + // Splitting up a long run from prev to nextBreak in lots of approximately lengthEachSubdivision. - // For very long runs add extra breaks after spaces or if no spaces before low punctuation. const int startSegment = subBreak; - if ((nextBreak - subBreak) <= lengthEachSubdivision) { - subBreak = -1; - return TextSegment(startSegment, nextBreak - startSegment); + const int remaining = nextBreak - startSegment; + int lengthSegment = remaining; + if (lengthSegment > lengthEachSubdivision) { + lengthSegment = static_cast<int>(pdoc->SafeSegment(std::string_view(&ll->chars[startSegment], lengthEachSubdivision))); + } + if (lengthSegment < remaining) { + subBreak += lengthSegment; } else { - subBreak += pdoc->SafeSegment(&ll->chars[subBreak], nextBreak-subBreak, lengthEachSubdivision); - if (subBreak >= nextBreak) { - subBreak = -1; - return TextSegment(startSegment, nextBreak - startSegment); - } else { - return TextSegment(startSegment, subBreak - startSegment); - } + subBreak = -1; } + return TextSegment(startSegment, lengthSegment); } bool BreakFinder::More() const noexcept { Modified: scintilla/src/PositionCache.h 24 lines changed, 11 insertions(+), 13 deletions(-) =================================================================== @@ -10,14 +10,6 @@ namespace Scintilla::Internal { -inline constexpr bool IsEOLChar(int ch) noexcept { - return (ch == '\r') || (ch == '\n'); -} - -inline constexpr bool IsSpaceOrTab(int ch) noexcept { - return ch == ' ' || ch == '\t'; -} - /** * A point in document space. * Uses double for sufficient resolution in large (>20,000,000 line) documents. @@ -208,7 +200,8 @@ typedef std::map<unsigned int, Representation> MapRepresentation; class SpecialRepresentations { MapRepresentation mapReprs; - short startByteHasReprs[0x100] {}; + unsigned short startByteHasReprs[0x100] {}; + unsigned int maxKey = 0; bool crlf = false; public: void SetRepresentation(std::string_view charBytes, std::string_view value); @@ -217,7 +210,6 @@ class SpecialRepresentations { void ClearRepresentation(std::string_view charBytes); const Representation *GetRepresentation(std::string_view charBytes) const; const Representation *RepresentationFromCharacter(std::string_view charBytes) const; - bool Contains(std::string_view charBytes) const; bool ContainsCrLf() const noexcept { return crlf; } @@ -250,7 +242,7 @@ class BreakFinder { int saeNext; int subBreak; const Document *pdoc; - EncodingFamily encodingFamily; + const EncodingFamily encodingFamily; const SpecialRepresentations *preprs; void Insert(Sci::Position val); public: @@ -259,14 +251,20 @@ class BreakFinder { enum { lengthStartSubdivision = 300 }; // Try to make each subdivided run lengthEachSubdivision or shorter. enum { lengthEachSubdivision = 100 }; + enum class BreakFor { + Text = 0, + Selection = 1, + Foreground = 2, + ForegroundAndSelection = 3, + }; BreakFinder(const LineLayout *ll_, const Selection *psel, Range lineRange_, Sci::Position posLineStart_, - XYPOSITION xStart, bool breakForSelection, const Document *pdoc_, const SpecialRepresentations *preprs_, const ViewStyle *pvsDraw); + XYPOSITION xStart, BreakFor breakFor, const Document *pdoc_, const SpecialRepresentations *preprs_, const ViewStyle *pvsDraw); // Deleted so BreakFinder objects can not be copied. BreakFinder(const BreakFinder &) = delete; BreakFinder(BreakFinder &&) = delete; void operator=(const BreakFinder &) = delete; void operator=(BreakFinder &&) = delete; - ~BreakFinder(); + ~BreakFinder() noexcept; TextSegment Next(); bool More() const noexcept; }; Modified: scintilla/src/ViewStyle.cxx 32 lines changed, 13 insertions(+), 19 deletions(-) =================================================================== @@ -136,8 +136,6 @@ ViewStyle::ViewStyle(size_t stylesSize_) : Element::SelectionBack, Element::SelectionInactiveBack, }); - selection.layer = Layer::Base; - selection.eolFilled = false; foldmarginColour.reset(); foldmarginHighlightColour.reset(); @@ -155,15 +153,9 @@ ViewStyle::ViewStyle(size_t stylesSize_) : Element::Caret, Element::CaretAdditional, }); - caret.style = CaretStyle::Line; - caret.width = 1; elementColours.erase(Element::CaretLineBack); elementAllowsTranslucent.insert(Element::CaretLineBack); - caretLine.alwaysShow = false; - caretLine.subLine = false; - caretLine.layer = Layer::Base; - caretLine.frame = 0; someStylesProtected = false; someStylesForceCase = false; @@ -210,12 +202,6 @@ ViewStyle::ViewStyle(size_t stylesSize_) : ctrlCharPadding = 3; // +3 For a blank on front and rounded edge each side lastSegItalicsOffset = 2; - wrap.state = Wrap::None; - wrap.visualFlags = WrapVisualFlag::None; - wrap.visualFlagsLocation = WrapVisualLocation::Default; - wrap.visualStartIndent = 0; - wrap.indentMode = WrapIndentMode::Fixed; - localeName = localeNameDefault; } @@ -661,26 +647,34 @@ bool ViewStyle::SetWrapIndentMode(WrapIndentMode wrapIndentMode_) noexcept { bool ViewStyle::IsBlockCaretStyle() const noexcept { return ((caret.style & CaretStyle::InsMask) == CaretStyle::Block) || - FlagSet(caret.style, CaretStyle::OverstrikeBlock); + FlagSet(caret.style, CaretStyle::OverstrikeBlock) || + FlagSet(caret.style, CaretStyle::Curses); } -bool ViewStyle::IsCaretVisible() const noexcept { - return caret.width > 0 && caret.style != CaretStyle::Invisible; +bool ViewStyle::IsCaretVisible(bool isMainSelection) const noexcept { + return caret.width > 0 && + ((caret.style & CaretStyle::InsMask) != CaretStyle::Invisible || + (FlagSet(caret.style, CaretStyle::Curses) && !isMainSelection)); // only draw additional selections in curses mode } bool ViewStyle::DrawCaretInsideSelection(bool inOverstrike, bool imeCaretBlockOverride) const noexcept { if (FlagSet(caret.style, CaretStyle::BlockAfter)) return false; return ((caret.style & CaretStyle::InsMask) == CaretStyle::Block) || (inOverstrike && FlagSet(caret.style, CaretStyle::OverstrikeBlock)) || - imeCaretBlockOverride; + imeCaretBlockOverride || + FlagSet(caret.style, CaretStyle::Curses); } -ViewStyle::CaretShape ViewStyle::CaretShapeForMode(bool inOverstrike) const noexcept { +ViewStyle::CaretShape ViewStyle::CaretShapeForMode(bool inOverstrike, bool isMainSelection) const noexcept { if (inOverstrike) { return (FlagSet(caret.style, CaretStyle::OverstrikeBlock)) ? CaretShape::block : CaretShape::bar; } + if (FlagSet(caret.style, CaretStyle::Curses) && !isMainSelection) { + return CaretShape::block; + } + const CaretStyle caretStyle = caret.style & CaretStyle::InsMask; return (caretStyle <= CaretStyle::Block) ? static_cast<CaretShape>(caretStyle) : CaretShape::line; } Modified: scintilla/src/ViewStyle.h 38 lines changed, 19 insertions(+), 19 deletions(-) =================================================================== @@ -47,40 +47,40 @@ inline std::optional<ColourRGBA> OptionalColour(Scintilla::uptr_t wParam, Scinti struct SelectionAppearance { // Whether to draw on base layer or over text - Scintilla::Layer layer; + Scintilla::Layer layer = Layer::Base; // Draw selection past line end characters up to right border - bool eolFilled; + bool eolFilled = false; }; struct CaretLineAppearance { // Whether to draw on base layer or over text - Scintilla::Layer layer; + Scintilla::Layer layer = Layer::Base; // Also show when non-focused - bool alwaysShow; + bool alwaysShow = false; // highlight sub line instead of whole line - bool subLine; + bool subLine = false; // Non-0: draw a rectangle around line instead of filling line. Value is pixel width of frame - int frame; + int frame = 0; }; struct CaretAppearance { // Line, block, over-strike bar ... - Scintilla::CaretStyle style; + Scintilla::CaretStyle style = CaretStyle::Line; // Width in pixels - int width; + int width = 1; }; struct WrapAppearance { // No wrapping, word, character, whitespace appearance - Scintilla::Wrap state; + Scintilla::Wrap state = Wrap::None; // Show indication of wrap at line end, line start, or in margin - Scintilla::WrapVisualFlag visualFlags; + Scintilla::WrapVisualFlag visualFlags = WrapVisualFlag::None; // Show indication near margin or near text - Scintilla::WrapVisualLocation visualFlagsLocation; + Scintilla::WrapVisualLocation visualFlagsLocation = WrapVisualLocation::Default; // How much indentation to show wrapping - int visualStartIndent; - // WrapIndentMode::Fixed, _SAME, _INDENT, _DEEPINDENT - Scintilla::WrapIndentMode indentMode; + int visualStartIndent = 0; + // WrapIndentMode::Fixed, Same, Indent, DeepIndent + Scintilla::WrapIndentMode indentMode = WrapIndentMode::Fixed; }; struct EdgeProperties { @@ -137,10 +137,10 @@ class ViewStyle { /// Margins are ordered: Line Numbers, Selection Margin, Spacing Margin int leftMarginWidth; ///< Spacing margin on left of text int rightMarginWidth; ///< Spacing margin on right of text - int maskInLine; ///< Mask for markers to be put into text because there is nowhere for them to go in margin - int maskDrawInText; ///< Mask for markers that always draw in text + int maskInLine = 0; ///< Mask for markers to be put into text because there is nowhere for them to go in margin + int maskDrawInText = 0; ///< Mask for markers that always draw in text std::vector<MarginStyle> ms; - int fixedColumnWidth; ///< Total width of margins + int fixedColumnWidth = 0; ///< Total width of margins bool marginInside; ///< true: margin included in text view, false: separate views int textStart; ///< Starting x position of text within the view int zoomLevel; @@ -235,9 +235,9 @@ class ViewStyle { enum class CaretShape { invisible, line, block, bar }; bool IsBlockCaretStyle() const noexcept; - bool IsCaretVisible() const noexcept; + bool IsCaretVisible(bool isMainSelection) const noexcept; bool DrawCaretInsideSelection(bool inOverstrike, bool imeCaretBlockOverride) const noexcept; - CaretShape CaretShapeForMode(bool inOverstrike) const noexcept; + CaretShape CaretShapeForMode(bool inOverstrike, bool isMainSelection) const noexcept; private: void AllocStyles(size_t sizeNew); Modified: scintilla/src/XPM.cxx 29 lines changed, 10 insertions(+), 19 deletions(-) =================================================================== @@ -7,6 +7,7 @@ #include <cstdlib> #include <cstring> +#include <climits> #include <stdexcept> #include <string_view> @@ -92,17 +93,14 @@ XPM::XPM(const char *const *linesForm) { Init(linesForm); } -XPM::~XPM() { -} - void XPM::Init(const char *textForm) { // Test done is two parts to avoid possibility of overstepping the memory // if memcmp implemented strangely. Must be 4 bytes at least at destination. if ((0 == memcmp(textForm, "/* X", 4)) && (0 == memcmp(textForm, "/* XPM */", 9))) { // Build the lines form out of the text form std::vector<const char *> linesForm = LinesFormFromTextForm(textForm); if (!linesForm.empty()) { - Init(&linesForm[0]); + Init(linesForm.data()); } } else { // It is really in line form @@ -146,7 +144,7 @@ void XPM::Init(const char *const *linesForm) { colourCodeTable[static_cast<unsigned char>(code)] = colour; } - for (int y=0; y<height; y++) { + for (ptrdiff_t y=0; y<height; y++) { const char *lform = linesForm[y+nColours+1]; const size_t len = MeasureLength(lform); for (size_t x = 0; x<len; x++) @@ -241,19 +239,16 @@ RGBAImage::RGBAImage(const XPM &xpm) { } } -RGBAImage::~RGBAImage() { -} - int RGBAImage::CountBytes() const noexcept { return width * height * 4; } const unsigned char *RGBAImage::Pixels() const noexcept { - return &pixelBytes[0]; + return pixelBytes.data(); } void RGBAImage::SetPixel(int x, int y, ColourRGBA colour) noexcept { - unsigned char *pixel = &pixelBytes[0] + (y * width + x) * 4; + unsigned char *pixel = pixelBytes.data() + (y * width + x) * 4; // RGBA pixel[0] = colour.GetRed(); pixel[1] = colour.GetGreen(); @@ -267,9 +262,9 @@ void RGBAImage::BGRAFromRGBA(unsigned char *pixelsBGRA, const unsigned char *pix for (size_t i = 0; i < count; i++) { const unsigned char alpha = pixelsRGBA[3]; // Input is RGBA, output is BGRA with premultiplied alpha - pixelsBGRA[2] = pixelsRGBA[0] * alpha / 255; - pixelsBGRA[1] = pixelsRGBA[1] * alpha / 255; - pixelsBGRA[0] = pixelsRGBA[2] * alpha / 255; + pixelsBGRA[2] = pixelsRGBA[0] * alpha / UCHAR_MAX; + pixelsBGRA[1] = pixelsRGBA[1] * alpha / UCHAR_MAX; + pixelsBGRA[0] = pixelsRGBA[2] * alpha / UCHAR_MAX; pixelsBGRA[3] = alpha; pixelsRGBA += bytesPerPixel; pixelsBGRA += bytesPerPixel; @@ -279,10 +274,6 @@ void RGBAImage::BGRAFromRGBA(unsigned char *pixelsBGRA, const unsigned char *pix RGBAImageSet::RGBAImageSet() : height(-1), width(-1) { } -RGBAImageSet::~RGBAImageSet() { - Clear(); -} - /// Remove all images. void RGBAImageSet::Clear() noexcept { images.clear(); @@ -307,7 +298,7 @@ RGBAImage *RGBAImageSet::Get(int ident) { } /// Give the largest height of the set. -int RGBAImageSet::GetHeight() const { +int RGBAImageSet::GetHeight() const noexcept { if (height < 0) { for (const std::pair<const int, std::unique_ptr<RGBAImage>> &image : images) { if (height < image.second->GetHeight()) { @@ -319,7 +310,7 @@ int RGBAImageSet::GetHeight() const { } /// Give the largest width of the set. -int RGBAImageSet::GetWidth() const { +int RGBAImageSet::GetWidth() const noexcept { if (width < 0) { for (const std::pair<const int, std::unique_ptr<RGBAImage>> &image : images) { if (width < image.second->GetWidth()) { Modified: scintilla/src/XPM.h 20 lines changed, 2 insertions(+), 18 deletions(-) =================================================================== @@ -25,11 +25,6 @@ class XPM { public: explicit XPM(const char *textForm); explicit XPM(const char *const *linesForm); - XPM(const XPM &) = default; - XPM(XPM &&) noexcept = default; - XPM &operator=(const XPM &) = default; - XPM &operator=(XPM &&) noexcept = default; - ~XPM(); void Init(const char *textForm); void Init(const char *const *linesForm); /// Decompose image into runs and use FillRectangle for each run @@ -53,11 +48,6 @@ class RGBAImage { static constexpr size_t bytesPerPixel = 4; RGBAImage(int width_, int height_, float scale_, const unsigned char *pixels_); explicit RGBAImage(const XPM &xpm); - RGBAImage(const RGBAImage &) = default; - RGBAImage(RGBAImage &&) noexcept = default; - RGBAImage &operator=(const RGBAImage &) = default; - RGBAImage &operator=(RGBAImage &&) noexcept = default; - virtual ~RGBAImage(); int GetHeight() const noexcept { return height; } int GetWidth() const noexcept { return width; } float GetScale() const noexcept { return scale; } @@ -79,22 +69,16 @@ class RGBAImageSet { mutable int width; ///< Memorize largest width of the set. public: RGBAImageSet(); - // Deleted so RGBAImageSet objects can not be copied. - RGBAImageSet(const RGBAImageSet &) = delete; - RGBAImageSet(RGBAImageSet &&) = delete; - RGBAImageSet &operator=(const RGBAImageSet &) = delete; - RGBAImageSet &operator=(RGBAImageSet &&) = delete; - ~RGBAImageSet(); /// Remove all images. void Clear() noexcept; /// Add an image. void AddImage(int ident, std::unique_ptr<RGBAImage> image); /// Get image by id. RGBAImage *Get(int ident); /// Give the largest height of the set. - int GetHeight() const; + int GetHeight() const noexcept; /// Give the largest width of the set. - int GetWidth() const; + int GetWidth() const noexcept; }; } Modified: scintilla/version.txt 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -1 +1 @@ -513 +514 -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
[geany/geany] 6d109b: Update to Scintilla 5.1.3 and Lexilla 5.1.2
by Thomas Martitz
15 Nov '21
15 Nov '21
Branch: refs/heads/master Author: Thomas Martitz <thomas.martitz(a)mailbox.org> Committer: Thomas Martitz <thomas.martitz(a)mailbox.org> Date: Mon, 15 Nov 2021 06:46:40 UTC Commit: 6d109b309165ff0bfb17a2b21056bd498d54c032
https://github.com/geany/geany/commit/6d109b309165ff0bfb17a2b21056bd498d54c…
Log Message: ----------- Update to Scintilla 5.1.3 and Lexilla 5.1.2 Notable changes: Scintilla: - Add SC_ELEMENT_FOLD_LINE to set the colour of fold lines. Add SC_ELEMENT_HIDDEN_LINE to show where lines are hidden. - On GTK, fix the line spacing so that underscores and accents are visible for some fonts such as DejaVu Sans Mono 10. Lexilla - Implement conditional group rules in CSS. Issue #25, Pull request #28. - Check PHP numeric literals, showing invalid values with default style instead of numeric. Issue #20. The CSS change causes compatiblity trouble. We exposed the changed style in filetypes.css. Users must update local copies. Modified Paths: -------------- data/filedefs/filetypes.css scintilla/gtk/PlatGTK.cxx scintilla/gtk/ScintillaGTK.cxx scintilla/gtk/ScintillaGTK.h scintilla/gtk/ScintillaGTKAccessible.cxx scintilla/include/Scintilla.h scintilla/include/Scintilla.iface scintilla/include/ScintillaCall.h scintilla/include/ScintillaMessages.h scintilla/include/ScintillaTypes.h scintilla/lexilla/include/SciLexer.h scintilla/lexilla/lexers/LexCSS.cxx scintilla/lexilla/lexers/LexHTML.cxx scintilla/lexilla/lexers/LexMarkdown.cxx scintilla/lexilla/lexlib/WordList.cxx scintilla/lexilla/lexlib/WordList.h scintilla/lexilla/version.txt scintilla/src/AutoComplete.cxx scintilla/src/AutoComplete.h scintilla/src/CallTip.cxx scintilla/src/CallTip.h scintilla/src/CaseConvert.cxx scintilla/src/CaseFolder.cxx scintilla/src/CaseFolder.h scintilla/src/CellBuffer.cxx scintilla/src/ContractionState.cxx scintilla/src/Decoration.cxx scintilla/src/Document.cxx scintilla/src/Document.h scintilla/src/EditModel.cxx scintilla/src/EditModel.h scintilla/src/EditView.cxx scintilla/src/Editor.cxx scintilla/src/Editor.h scintilla/src/Geometry.cxx scintilla/src/Geometry.h scintilla/src/Indicator.cxx scintilla/src/KeyMap.cxx scintilla/src/KeyMap.h scintilla/src/LineMarker.cxx scintilla/src/MarginView.cxx scintilla/src/MarginView.h scintilla/src/PositionCache.cxx scintilla/src/PositionCache.h scintilla/src/RESearch.cxx scintilla/src/RESearch.h scintilla/src/ScintillaBase.cxx scintilla/src/Selection.cxx scintilla/src/Selection.h scintilla/src/Style.cxx scintilla/src/Style.h scintilla/src/UniConversion.h scintilla/src/UniqueString.cxx scintilla/src/UniqueString.h scintilla/src/ViewStyle.cxx scintilla/src/ViewStyle.h scintilla/version.txt src/highlightingmappings.h Modified: data/filedefs/filetypes.css 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -24,7 +24,7 @@ pseudoelement=string_2 extended_identifier=keyword_1 extended_pseudoclass=string_1 extended_pseudoelement=string_2 -media=parameter +group_rule=parameter [keywords] # CSS 1 properties Modified: scintilla/gtk/PlatGTK.cxx 4 lines changed, 2 insertions(+), 2 deletions(-) =================================================================== @@ -1073,7 +1073,7 @@ XYPOSITION SurfaceImpl::Ascent(const Font *font_) { if (PFont(font_)->pfd) { PangoFontMetrics *metrics = pango_context_get_metrics(pcontext, PFont(font_)->pfd, pango_context_get_language(pcontext)); - ascent = std::round(floatFromPangoUnits( + ascent = std::ceil(floatFromPangoUnits( pango_font_metrics_get_ascent(metrics))); pango_font_metrics_unref(metrics); } @@ -1087,7 +1087,7 @@ XYPOSITION SurfaceImpl::Descent(const Font *font_) { if (PFont(font_)->pfd) { PangoFontMetrics *metrics = pango_context_get_metrics(pcontext, PFont(font_)->pfd, pango_context_get_language(pcontext)); - const XYPOSITION descent = std::round(floatFromPangoUnits( + const XYPOSITION descent = std::ceil(floatFromPangoUnits( pango_font_metrics_get_descent(metrics))); pango_font_metrics_unref(metrics); return descent; Modified: scintilla/gtk/ScintillaGTK.cxx 50 lines changed, 38 insertions(+), 12 deletions(-) =================================================================== @@ -5,6 +5,7 @@ #include <cstddef> #include <cstdlib> +#include <cstdint> #include <cassert> #include <cstring> #include <cstdio> @@ -179,6 +180,18 @@ GdkAtom SelectionOfGSD(GtkSelectionData *sd) noexcept { return gtk_selection_data_get_selection(sd); } +bool SettingGet(GtkSettings *settings, const gchar *name, gpointer value) noexcept { + if (!settings) { + return false; + } + if (!g_object_class_find_property(G_OBJECT_GET_CLASS( + G_OBJECT(settings)), name)) { + return false; + } + g_object_get(G_OBJECT(settings), name, value, nullptr); + return true; +} + } FontOptions::FontOptions(GtkWidget *widget) noexcept { @@ -218,6 +231,8 @@ ScintillaGTK::ScintillaGTK(_ScintillaObject *sci_) : preeditInitialized(false), im_context(nullptr), lastNonCommonScript(G_UNICODE_SCRIPT_INVALID_CODE), + settings(nullptr), + settingsHandlerId(0), lastWheelMouseTime(0), lastWheelMouseDirection(0), wheelMouseIntensity(0), @@ -264,6 +279,12 @@ ScintillaGTK::~ScintillaGTK() { } ClearPrimarySelection(); wPreedit.Destroy(); + if (settingsHandlerId) { + g_signal_handler_disconnect(settings, settingsHandlerId); + } + if (settings) { + g_object_unref(settings); + } } void ScintillaGTK::RealizeThis(GtkWidget *widget) { @@ -341,6 +362,15 @@ void ScintillaGTK::RealizeThis(GtkWidget *widget) { cursor = gdk_cursor_new_for_display(pdisplay, GDK_LEFT_PTR); gdk_window_set_cursor(PWindow(scrollbarh), cursor); UnRefCursor(cursor); + + using NotifyLambda = void (*)(GObject *, GParamSpec *, ScintillaGTK *); + if (settings) { + settingsHandlerId = g_signal_connect(settings, "notify::gtk-xft-dpi", + G_CALLBACK(static_cast<NotifyLambda>([](GObject *, GParamSpec *, ScintillaGTK *sciThis) { + sciThis->InvalidateStyleRedraw(); + })), + this); + } } void ScintillaGTK::Realize(GtkWidget *widget) { @@ -669,20 +699,16 @@ void ScintillaGTK::Init() { gtk_container_add(GTK_CONTAINER(PWidget(wPreedit)), predrw); gtk_widget_show(predrw); + settings = gtk_settings_get_default(); + // Set caret period based on GTK settings gboolean blinkOn = false; - if (g_object_class_find_property(G_OBJECT_GET_CLASS( - G_OBJECT(gtk_settings_get_default())), "gtk-cursor-blink")) { - g_object_get(G_OBJECT( - gtk_settings_get_default()), "gtk-cursor-blink", &blinkOn, nullptr); - } - if (blinkOn && - g_object_class_find_property(G_OBJECT_GET_CLASS( - G_OBJECT(gtk_settings_get_default())), "gtk-cursor-blink-time")) { - gint value; - g_object_get(G_OBJECT( - gtk_settings_get_default()), "gtk-cursor-blink-time", &value, nullptr); - caret.period = static_cast<int>(value / 1.75); + SettingGet(settings, "gtk-cursor-blink", &blinkOn); + if (blinkOn) { + gint value = 500; + if (SettingGet(settings, "gtk-cursor-blink-time", &value)) { + caret.period = static_cast<int>(value / 1.75); + } } else { caret.period = 0; } Modified: scintilla/gtk/ScintillaGTK.h 3 lines changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -62,6 +62,9 @@ class ScintillaGTK : public ScintillaBase { GtkIMContext *im_context; GUnicodeScript lastNonCommonScript; + GtkSettings *settings; + gulong settingsHandlerId; + // Wheel mouse support unsigned int linesPerScroll; gint64 lastWheelMouseTime; Modified: scintilla/gtk/ScintillaGTKAccessible.cxx 1 lines changed, 1 insertions(+), 0 deletions(-) =================================================================== @@ -53,6 +53,7 @@ #include <cstddef> #include <cstdlib> +#include <cstdint> #include <cassert> #include <cstring> Modified: scintilla/include/Scintilla.h 6 lines changed, 6 insertions(+), 0 deletions(-) =================================================================== @@ -272,6 +272,8 @@ typedef sptr_t (*SciFnDirectStatus)(sptr_t ptr, unsigned int iMessage, uptr_t wP #define SCI_STYLEGETWEIGHT 2064 #define SCI_STYLESETCHARACTERSET 2066 #define SCI_STYLESETHOTSPOT 2409 +#define SCI_STYLESETCHECKMONOSPACED 2254 +#define SCI_STYLEGETCHECKMONOSPACED 2255 #define SC_ELEMENT_LIST 0 #define SC_ELEMENT_LIST_BACK 1 #define SC_ELEMENT_LIST_SELECTED 2 @@ -291,6 +293,8 @@ typedef sptr_t (*SciFnDirectStatus)(sptr_t ptr, unsigned int iMessage, uptr_t wP #define SC_ELEMENT_WHITE_SPACE_BACK 61 #define SC_ELEMENT_HOT_SPOT_ACTIVE 70 #define SC_ELEMENT_HOT_SPOT_ACTIVE_BACK 71 +#define SC_ELEMENT_FOLD_LINE 80 +#define SC_ELEMENT_HIDDEN_LINE 81 #define SCI_SETELEMENTCOLOUR 2753 #define SCI_GETELEMENTCOLOUR 2754 #define SCI_RESETELEMENTCOLOUR 2755 @@ -310,6 +314,8 @@ typedef sptr_t (*SciFnDirectStatus)(sptr_t ptr, unsigned int iMessage, uptr_t wP #define SCI_SETSELECTIONLAYER 2763 #define SCI_GETCARETLINELAYER 2764 #define SCI_SETCARETLINELAYER 2765 +#define SCI_GETCARETLINEHIGHLIGHTSUBLINE 2773 +#define SCI_SETCARETLINEHIGHLIGHTSUBLINE 2774 #define SCI_SETCARETFORE 2069 #define SCI_ASSIGNCMDKEY 2070 #define SCI_CLEARCMDKEY 2071 Modified: scintilla/include/Scintilla.iface 14 lines changed, 14 insertions(+), 0 deletions(-) =================================================================== @@ -677,6 +677,12 @@ set void StyleSetCharacterSet=2066(int style, CharacterSet characterSet) # Set a style to be a hotspot or not. set void StyleSetHotSpot=2409(int style, bool hotspot) +# Indicate that a style may be monospaced over ASCII graphics characters which enables optimizations. +set void StyleSetCheckMonospaced=2254(int style, bool checkMonospaced) + +# Get whether a style may be monospaced. +get bool StyleGetCheckMonospaced=2255(int style,) + enu Element=SC_ELEMENT_ val SC_ELEMENT_LIST=0 val SC_ELEMENT_LIST_BACK=1 @@ -697,6 +703,8 @@ val SC_ELEMENT_WHITE_SPACE=60 val SC_ELEMENT_WHITE_SPACE_BACK=61 val SC_ELEMENT_HOT_SPOT_ACTIVE=70 val SC_ELEMENT_HOT_SPOT_ACTIVE_BACK=71 +val SC_ELEMENT_FOLD_LINE=80 +val SC_ELEMENT_HIDDEN_LINE=81 # Set the colour of an element. Translucency (alpha) may or may not be significant # and this may depend on the platform. The alpha byte should commonly be 0xff for opaque. @@ -753,6 +761,12 @@ get Layer GetCaretLineLayer=2764(,) # Set the layer of the background of the line containing the caret. set void SetCaretLineLayer=2765(Layer layer,) +# Get only highlighting subline instead of whole line. +get bool GetCaretLineHighlightSubLine=2773(,) + +# Set only highlighting subline instead of whole line. +set void SetCaretLineHighlightSubLine=2774(bool subLine,) + # Set the foreground colour of the caret. set void SetCaretFore=2069(colour fore,) Modified: scintilla/include/ScintillaCall.h 4 lines changed, 4 insertions(+), 0 deletions(-) =================================================================== @@ -196,6 +196,8 @@ class ScintillaCall { Scintilla::FontWeight StyleGetWeight(int style); void StyleSetCharacterSet(int style, Scintilla::CharacterSet characterSet); void StyleSetHotSpot(int style, bool hotspot); + void StyleSetCheckMonospaced(int style, bool checkMonospaced); + bool StyleGetCheckMonospaced(int style); void SetElementColour(Scintilla::Element element, ColourAlpha colourElement); ColourAlpha ElementColour(Scintilla::Element element); void ResetElementColour(Scintilla::Element element); @@ -212,6 +214,8 @@ class ScintillaCall { void SetSelectionLayer(Scintilla::Layer layer); Scintilla::Layer CaretLineLayer(); void SetCaretLineLayer(Scintilla::Layer layer); + bool CaretLineHighlightSubLine(); + void SetCaretLineHighlightSubLine(bool subLine); void SetCaretFore(Colour fore); void AssignCmdKey(int keyDefinition, int sciCommand); void ClearCmdKey(int keyDefinition); Modified: scintilla/include/ScintillaMessages.h 4 lines changed, 4 insertions(+), 0 deletions(-) =================================================================== @@ -133,6 +133,8 @@ enum class Message { StyleGetWeight = 2064, StyleSetCharacterSet = 2066, StyleSetHotSpot = 2409, + StyleSetCheckMonospaced = 2254, + StyleGetCheckMonospaced = 2255, SetElementColour = 2753, GetElementColour = 2754, ResetElementColour = 2755, @@ -149,6 +151,8 @@ enum class Message { SetSelectionLayer = 2763, GetCaretLineLayer = 2764, SetCaretLineLayer = 2765, + GetCaretLineHighlightSubLine = 2773, + SetCaretLineHighlightSubLine = 2774, SetCaretFore = 2069, AssignCmdKey = 2070, ClearCmdKey = 2071, Modified: scintilla/include/ScintillaTypes.h 2 lines changed, 2 insertions(+), 0 deletions(-) =================================================================== @@ -180,6 +180,8 @@ enum class Element { WhiteSpaceBack = 61, HotSpotActive = 70, HotSpotActiveBack = 71, + FoldLine = 80, + HiddenLine = 81, }; enum class Layer { Modified: scintilla/lexilla/include/SciLexer.h 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -765,7 +765,7 @@ #define SCE_CSS_EXTENDED_IDENTIFIER 19 #define SCE_CSS_EXTENDED_PSEUDOCLASS 20 #define SCE_CSS_EXTENDED_PSEUDOELEMENT 21 -#define SCE_CSS_MEDIA 22 +#define SCE_CSS_GROUP_RULE 22 #define SCE_CSS_VARIABLE 23 #define SCE_POV_DEFAULT 0 #define SCE_POV_COMMENT 1 Modified: scintilla/lexilla/lexers/LexCSS.cxx 8 lines changed, 4 insertions(+), 4 deletions(-) =================================================================== @@ -209,7 +209,7 @@ static void ColouriseCssDoc(Sci_PositionU startPos, Sci_Position length, int ini case '{': nestingLevel++; switch (lastState) { - case SCE_CSS_MEDIA: + case SCE_CSS_GROUP_RULE: sc.SetState(SCE_CSS_DEFAULT); break; case SCE_CSS_TAG: @@ -458,8 +458,8 @@ static void ColouriseCssDoc(Sci_PositionU startPos, Sci_Position length, int ini sc.ChangeState(SCE_CSS_VALUE); break; case SCE_CSS_DIRECTIVE: - if (op == '@' && strcmp(s2, "media") == 0) - sc.ChangeState(SCE_CSS_MEDIA); + if (op == '@' && (strcmp(s2, "media") == 0 || strcmp(s2, "supports") == 0 || strcmp(s2, "document") == 0 || strcmp(s2, "-moz-document") == 0)) + sc.ChangeState(SCE_CSS_GROUP_RULE); break; } } @@ -492,7 +492,7 @@ static void ColouriseCssDoc(Sci_PositionU startPos, Sci_Position length, int ini } else if (IsCssOperator(sc.ch) && (sc.state != SCE_CSS_ATTRIBUTE || sc.ch == ']') && (sc.state != SCE_CSS_VALUE || sc.ch == ';' || sc.ch == '}' || sc.ch == '!') - && ((sc.state != SCE_CSS_DIRECTIVE && sc.state != SCE_CSS_MEDIA) || sc.ch == ';' || sc.ch == '{') + && ((sc.state != SCE_CSS_DIRECTIVE && sc.state != SCE_CSS_GROUP_RULE) || sc.ch == ';' || sc.ch == '{') ) { if (sc.state != SCE_CSS_OPERATOR) lastState = sc.state; Modified: scintilla/lexilla/lexers/LexHTML.cxx 140 lines changed, 127 insertions(+), 13 deletions(-) =================================================================== @@ -524,6 +524,119 @@ bool isDjangoBlockEnd(const int ch, const int chNext, const std::string &blockTy } } +class PhpNumberState { + enum NumberBase { BASE_10 = 0, BASE_2, BASE_8, BASE_16 }; + static constexpr const char *const digitList[] = { "_0123456789", "_01", "_01234567", "_0123456789abcdefABCDEF" }; + + NumberBase base = BASE_10; + bool decimalPart = false; + bool exponentPart = false; + bool invalid = false; + bool finished = false; + + bool leadingZero = false; + bool invalidBase8 = false; + + bool betweenDigits = false; + bool decimalChar = false; + bool exponentChar = false; + +public: + inline bool isInvalid() { return invalid; } + inline bool isFinished() { return finished; } + + bool init(int ch, int chPlus1, int chPlus2) { + base = BASE_10; + decimalPart = false; + exponentPart = false; + invalid = false; + finished = false; + + leadingZero = false; + invalidBase8 = false; + + betweenDigits = false; + decimalChar = false; + exponentChar = false; + + if (ch == '.' && strchr(digitList[BASE_10] + !betweenDigits, chPlus1) != nullptr) { + decimalPart = true; + betweenDigits = true; + } else if (ch == '0' && (chPlus1 == 'b' || chPlus1 == 'B')) { + base = BASE_2; + } else if (ch == '0' && (chPlus1 == 'o' || chPlus1 == 'O')) { + base = BASE_8; + } else if (ch == '0' && (chPlus1 == 'x' || chPlus1 == 'X')) { + base = BASE_16; + } else if (strchr(digitList[BASE_10] + !betweenDigits, ch) != nullptr) { + leadingZero = ch == '0'; + betweenDigits = true; + check(chPlus1, chPlus2); + if (finished && leadingZero) { + // single zero should be base 10 + base = BASE_10; + } + } else { + return false; + } + return true; + } + + bool check(int ch, int chPlus1) { + if (strchr(digitList[base] + !betweenDigits, ch) != nullptr) { + if (leadingZero) { + invalidBase8 = invalidBase8 || strchr(digitList[BASE_8] + !betweenDigits, ch) == nullptr; + } + + betweenDigits = ch != '_'; + decimalChar = false; + exponentChar = false; + } else if (ch == '_') { + invalid = true; + + betweenDigits = false; + decimalChar = false; + // exponentChar is unchanged + } else if (base == BASE_10 && ch == '.' && ( + !(decimalPart || exponentPart) || strchr(digitList[BASE_10] + !betweenDigits, chPlus1) != nullptr) + ) { + invalid = invalid || !betweenDigits || decimalPart || exponentPart; + decimalPart = true; + + betweenDigits = false; + decimalChar = true; + exponentChar = false; + } else if (base == BASE_10 && (ch == 'e' || ch == 'E')) { + invalid = invalid || !(betweenDigits || decimalChar) || exponentPart; + exponentPart = true; + + betweenDigits = false; + decimalChar = false; + exponentChar = true; + } else if (base == BASE_10 && (ch == '-' || ch == '+') && exponentChar) { + invalid = invalid || strchr(digitList[BASE_10] + !betweenDigits, chPlus1) == nullptr; + + betweenDigits = false; + decimalChar = false; + // exponentChar is unchanged + } else if (IsPhpWordChar(ch)) { + invalid = true; + + betweenDigits = false; + decimalChar = false; + exponentChar = false; + } else { + invalid = invalid || !(betweenDigits || decimalChar); + finished = true; + if (base == BASE_10 && leadingZero && !decimalPart && !exponentPart) { + base = BASE_8; + invalid = invalid || invalidBase8; + } + } + return finished; + } +}; + bool isPHPStringState(int state) { return (state == SCE_HPHP_HSTRING) || @@ -960,6 +1073,7 @@ void SCI_METHOD LexerHTML::Lex(Sci_PositionU startPos, Sci_Position length, int } styler.StartAt(startPos); std::string prevWord; + PhpNumberState phpNumber; std::string phpStringDelimiter; int StateToPrint = initStyle; int state = stateForPrintState(StateToPrint); @@ -1254,7 +1368,7 @@ void SCI_METHOD LexerHTML::Lex(Sci_PositionU startPos, Sci_Position length, int ///////////////////////////////////// // handle the start of PHP pre-processor = Non-HTML else if ((state != SCE_H_ASPAT) && - !isStringState(state) && + !isPHPStringState(state) && (state != SCE_HPHP_COMMENT) && (state != SCE_HPHP_COMMENTLINE) && (ch == '<') && @@ -1430,6 +1544,7 @@ void SCI_METHOD LexerHTML::Lex(Sci_PositionU startPos, Sci_Position length, int (chPrev == '<') && (ch == '!') && (StateToPrint != SCE_H_CDATA) && + (!isStringState(StateToPrint)) && (!IsCommentState(StateToPrint)) && (!IsScriptCommentState(StateToPrint))) { beforePreProc = state; @@ -2273,7 +2388,7 @@ void SCI_METHOD LexerHTML::Lex(Sci_PositionU startPos, Sci_Position length, int break; ///////////// start - PHP state handling case SCE_HPHP_WORD: - if (!IsAWordChar(ch)) { + if (!IsPhpWordChar(ch)) { classifyWordHTPHP(styler.GetStartSegment(), i - 1, keywords5, styler); if (ch == '/' && chNext == '*') { i++; @@ -2306,15 +2421,9 @@ void SCI_METHOD LexerHTML::Lex(Sci_PositionU startPos, Sci_Position length, int } break; case SCE_HPHP_NUMBER: - // recognize bases 8,10 or 16 integers OR floating-point numbers - if (!IsADigit(ch) - && strchr(".xXabcdefABCDEF_", ch) == NULL - && ((ch != '-' && ch != '+') || (chPrev != 'e' && chPrev != 'E'))) { - styler.ColourTo(i - 1, SCE_HPHP_NUMBER); - if (IsOperator(ch)) - state = SCE_HPHP_OPERATOR; - else - state = SCE_HPHP_DEFAULT; + if (phpNumber.check(chNext, chNext2)) { + styler.ColourTo(i, phpNumber.isInvalid() ? SCE_HPHP_DEFAULT : SCE_HPHP_NUMBER); + state = SCE_HPHP_DEFAULT; } break; case SCE_HPHP_VARIABLE: @@ -2395,8 +2504,13 @@ void SCI_METHOD LexerHTML::Lex(Sci_PositionU startPos, Sci_Position length, int case SCE_HPHP_OPERATOR: case SCE_HPHP_DEFAULT: styler.ColourTo(i - 1, StateToPrint); - if (IsADigit(ch) || (ch == '.' && IsADigit(chNext))) { - state = SCE_HPHP_NUMBER; + if (phpNumber.init(ch, chNext, chNext2)) { + if (phpNumber.isFinished()) { + styler.ColourTo(i, phpNumber.isInvalid() ? SCE_HPHP_DEFAULT : SCE_HPHP_NUMBER); + state = SCE_HPHP_DEFAULT; + } else { + state = SCE_HPHP_NUMBER; + } } else if (IsAWordStart(ch)) { state = SCE_HPHP_WORD; } else if (ch == '/' && chNext == '*') { Modified: scintilla/lexilla/lexers/LexMarkdown.cxx 9 lines changed, 7 insertions(+), 2 deletions(-) =================================================================== @@ -56,8 +56,13 @@ using namespace Lexilla; -static inline bool IsNewline(const int ch) { - return (ch == '\n' || ch == '\r'); +namespace { + +constexpr bool IsNewline(const int ch) { + // sc.GetRelative(i) returns '\0' if out of range + return (ch == '\n' || ch == '\r' || ch == '\0'); +} + } // True if can follow ch down to the end with possibly trailing whitespace Modified: scintilla/lexilla/lexlib/WordList.cxx 85 lines changed, 34 insertions(+), 51 deletions(-) =================================================================== @@ -11,18 +11,20 @@ #include <algorithm> #include <iterator> +#include <memory> #include "WordList.h" using namespace Lexilla; +namespace { + /** * Creates an array that points into each word in the string and puts \0 terminators * after each word. */ -static char **ArrayFromWordList(char *wordlist, size_t slen, int *len, bool onlyLineEnds = false) { - int prev = '\n'; - int words = 0; +std::unique_ptr<char *[]> ArrayFromWordList(char *wordlist, size_t slen, size_t *len, bool onlyLineEnds = false) { + size_t words = 0; // For rapid determination of whether a character is a separator, build // a look up table. bool wordSeparator[256] = {}; // Initialise all to false. @@ -32,26 +34,27 @@ static char **ArrayFromWordList(char *wordlist, size_t slen, int *len, bool only wordSeparator[static_cast<unsigned int>(' ')] = true; wordSeparator[static_cast<unsigned int>('\t')] = true; } + unsigned char prev = '\n'; for (int j = 0; wordlist[j]; j++) { - const int curr = static_cast<unsigned char>(wordlist[j]); + const unsigned char curr = wordlist[j]; if (!wordSeparator[curr] && wordSeparator[prev]) words++; prev = curr; } - char **keywords = new char *[words + 1]; - int wordsStore = 0; + std::unique_ptr<char *[]> keywords = std::make_unique<char *[]>(words + 1); + size_t wordsStore = 0; if (words) { - prev = '\0'; + unsigned char previous = '\0'; for (size_t k = 0; k < slen; k++) { if (!wordSeparator[static_cast<unsigned char>(wordlist[k])]) { - if (!prev) { + if (!previous) { keywords[wordsStore] = &wordlist[k]; wordsStore++; } } else { wordlist[k] = '\0'; } - prev = wordlist[k]; + previous = wordlist[k]; } } assert(wordsStore < (words + 1)); @@ -60,8 +63,14 @@ static char **ArrayFromWordList(char *wordlist, size_t slen, int *len, bool only return keywords; } -WordList::WordList(bool onlyLineEnds_) : - words(0), list(0), len(0), onlyLineEnds(onlyLineEnds_) { +bool cmpWords(const char *a, const char *b) noexcept { + return strcmp(a, b) < 0; +} + +} + +WordList::WordList(bool onlyLineEnds_) noexcept : + words(nullptr), list(nullptr), len(0), onlyLineEnds(onlyLineEnds_) { // Prevent warnings by static analyzers about uninitialized starts. starts[0] = -1; } @@ -77,78 +86,52 @@ WordList::operator bool() const noexcept { bool WordList::operator!=(const WordList &other) const noexcept { if (len != other.len) return true; - for (int i=0; i<len; i++) { + for (size_t i=0; i<len; i++) { if (strcmp(words[i], other.words[i]) != 0) return true; } return false; } int WordList::Length() const noexcept { - return len; + return static_cast<int>(len); } void WordList::Clear() noexcept { - if (words) { - delete []list; - delete []words; - } - words = nullptr; + delete []list; list = nullptr; + delete []words; + words = nullptr; len = 0; } -#ifdef _MSC_VER - -static bool cmpWords(const char *a, const char *b) { - return strcmp(a, b) < 0; -} - -#else - -static int cmpWords(const void *a, const void *b) { - return strcmp(*static_cast<const char * const *>(a), *static_cast<const char * const *>(b)); -} - -static void SortWordList(char **words, unsigned int len) { - qsort(words, len, sizeof(*words), cmpWords); -} - -#endif - bool WordList::Set(const char *s) { const size_t lenS = strlen(s) + 1; - char *listTemp = new char[lenS]; - memcpy(listTemp, s, lenS); - int lenTemp = 0; - char **wordsTemp = ArrayFromWordList(listTemp, lenS - 1, &lenTemp, onlyLineEnds); -#ifdef _MSC_VER - std::sort(wordsTemp, wordsTemp + lenTemp, cmpWords); -#else - SortWordList(wordsTemp, lenTemp); -#endif + std::unique_ptr<char[]> listTemp = std::make_unique<char[]>(lenS); + memcpy(listTemp.get(), s, lenS); + size_t lenTemp = 0; + std::unique_ptr<char *[]> wordsTemp = ArrayFromWordList(listTemp.get(), lenS - 1, &lenTemp, onlyLineEnds); + std::sort(wordsTemp.get(), wordsTemp.get() + lenTemp, cmpWords); if (lenTemp == len) { bool changed = false; - for (int i = 0; i < lenTemp; i++) { + for (size_t i = 0; i < lenTemp; i++) { if (strcmp(words[i], wordsTemp[i]) != 0) { changed = true; break; } } if (!changed) { - delete []listTemp; - delete []wordsTemp; return false; } } Clear(); - words = wordsTemp; - list = listTemp; + words = wordsTemp.release(); + list = listTemp.release(); len = lenTemp; std::fill(starts, std::end(starts), -1); - for (int l = len - 1; l >= 0; l--) { + for (int l = static_cast<int>(len - 1); l >= 0; l--) { unsigned char indexChar = words[l][0]; starts[indexChar] = l; } Modified: scintilla/lexilla/lexlib/WordList.h 9 lines changed, 7 insertions(+), 2 deletions(-) =================================================================== @@ -16,11 +16,16 @@ class WordList { // Each word contains at least one character - a empty word acts as sentinel at the end. char **words; char *list; - int len; + size_t len; bool onlyLineEnds; ///< Delimited by any white space or only line ends int starts[256]; public: - explicit WordList(bool onlyLineEnds_ = false); + explicit WordList(bool onlyLineEnds_ = false) noexcept; + // Deleted so WordList objects can not be copied. + WordList(const WordList &) = delete; + WordList(WordList &&) = delete; + WordList &operator=(const WordList &) = delete; + WordList &operator=(WordList &&) = delete; ~WordList(); operator bool() const noexcept; bool operator!=(const WordList &other) const noexcept; Modified: scintilla/lexilla/version.txt 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -1 +1 @@ -511 +512 Modified: scintilla/src/AutoComplete.cxx 4 lines changed, 2 insertions(+), 2 deletions(-) =================================================================== @@ -211,7 +211,7 @@ void AutoComplete::Show(bool show) { lb->Select(0); } -void AutoComplete::Cancel() { +void AutoComplete::Cancel() noexcept { if (lb->Created()) { lb->Clear(); lb->Destroy(); @@ -272,7 +272,7 @@ void AutoComplete::Select(const char *word) { } } else if (cond < 0) { end = pivot - 1; - } else if (cond > 0) { + } else { // cond > 0 start = pivot + 1; } } Modified: scintilla/src/AutoComplete.h 7 lines changed, 6 insertions(+), 1 deletions(-) =================================================================== @@ -43,6 +43,11 @@ class AutoComplete { Scintilla::Ordering autoSort; AutoComplete(); + // Deleted so AutoComplete objects can not be copied. + AutoComplete(const AutoComplete &) = delete; + AutoComplete(AutoComplete &&) = delete; + AutoComplete &operator=(const AutoComplete &) = delete; + AutoComplete &operator=(AutoComplete &&) = delete; ~AutoComplete(); /// Is the auto completion list displayed? @@ -79,7 +84,7 @@ class AutoComplete { std::string GetValue(int item) const; void Show(bool show); - void Cancel(); + void Cancel() noexcept; /// Move the current list element by delta, scrolling appropriately void Move(int delta); Modified: scintilla/src/CallTip.cxx 4 lines changed, 2 insertions(+), 2 deletions(-) =================================================================== @@ -313,7 +313,7 @@ PRectangle CallTip::CallTipStart(Sci::Position pos, Point pt, int textHeight, co } } -void CallTip::CallTipCancel() { +void CallTip::CallTipCancel() noexcept { inCallTipMode = false; if (wCallTip.Created()) { wCallTip.Destroy(); @@ -345,7 +345,7 @@ void CallTip::SetPosition(bool aboveText) noexcept { } bool CallTip::UseStyleCallTip() const noexcept { - return useStyleCallTip; + return useStyleCallTip; } // It might be better to have two access functions for this and to use Modified: scintilla/src/CallTip.h 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -75,7 +75,7 @@ class CallTip { Scintilla::CharacterSet characterSet, Scintilla::Technology technology, const char *localeName, const Window &wParent); - void CallTipCancel(); + void CallTipCancel() noexcept; /// Set a range of characters to be displayed in a highlight style. /// Commonly used to highlight the current parameter. Modified: scintilla/src/CaseConvert.cxx 10 lines changed, 7 insertions(+), 3 deletions(-) =================================================================== @@ -607,9 +607,13 @@ class CaseConverter : public ICaseConverter { std::vector<ConversionString> conversions; public: - CaseConverter() noexcept { - } - virtual ~CaseConverter() = default; + CaseConverter() = default; + // Deleted so CaseConverter objects can not be copied. + CaseConverter(const CaseConverter &) = delete; + CaseConverter(CaseConverter &&) = delete; + CaseConverter &operator=(const CaseConverter &) = delete; + CaseConverter &operator=(CaseConverter &&) = delete; + virtual ~CaseConverter() noexcept = default; bool Initialised() const noexcept { return !characters.empty(); } Modified: scintilla/src/CaseFolder.cxx 3 lines changed, 0 insertions(+), 3 deletions(-) =================================================================== @@ -23,9 +23,6 @@ CaseFolderTable::CaseFolderTable() noexcept : mapping{} { } } -CaseFolderTable::~CaseFolderTable() { -} - size_t CaseFolderTable::Fold(char *folded, size_t sizeFolded, const char *mixed, size_t lenMixed) { if (lenMixed > sizeFolded) { return 0; Modified: scintilla/src/CaseFolder.h 1 lines changed, 0 insertions(+), 1 deletions(-) =================================================================== @@ -21,7 +21,6 @@ class CaseFolderTable : public CaseFolder { char mapping[256]; public: CaseFolderTable() noexcept; - ~CaseFolderTable() override; size_t Fold(char *folded, size_t sizeFolded, const char *mixed, size_t lenMixed) override; void SetTranslation(char ch, char chTranslation) noexcept; void StandardASCII() noexcept; Modified: scintilla/src/CellBuffer.cxx 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -523,7 +523,7 @@ void UndoHistory::TentativeCommit() { } bool UndoHistory::TentativeActive() const noexcept { - return tentativePoint >= 0; + return tentativePoint >= 0; } int UndoHistory::TentativeSteps() noexcept { Modified: scintilla/src/ContractionState.cxx 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -197,7 +197,7 @@ Sci::Line ContractionState<LINE>::DocFromDisplay(Sci::Line lineDisplay) const no if (OneToOne()) { return lineDisplay; } else { - if (lineDisplay <= 0) { + if (lineDisplay < 0) { return 0; } if (lineDisplay > LinesDisplayed()) { Modified: scintilla/src/Decoration.cxx 12 lines changed, 2 insertions(+), 10 deletions(-) =================================================================== @@ -39,8 +39,6 @@ class Decoration : public IDecoration { explicit Decoration(int indicator_) : indicator(indicator_) { } - ~Decoration() override { - } bool Empty() const noexcept override { return (rs.Runs() == 1) && (rs.AllSameAs(0)); @@ -75,7 +73,7 @@ template <typename POS> class DecorationList : public IDecorationList { int currentIndicator; int currentValue; - Decoration<POS> *current; // Cached so FillRange doesn't have to search for each call. + Decoration<POS> *current; // Non-owning. Cached so FillRange doesn't have to search for each call. Sci::Position lengthDocument; // Ordered by indicator std::vector<std::unique_ptr<Decoration<POS>>> decorationList; @@ -90,7 +88,6 @@ class DecorationList : public IDecorationList { public: DecorationList(); - ~DecorationList() override; const std::vector<const IDecoration*> &View() const noexcept override { return decorationView; @@ -128,11 +125,6 @@ DecorationList<POS>::DecorationList() : currentIndicator(0), currentValue(1), cu lengthDocument(0), clickNotified(false) { } -template <typename POS> -DecorationList<POS>::~DecorationList() { - current = nullptr; -} - template <typename POS> Decoration<POS> *DecorationList<POS>::DecorationFromIndicator(int indicator) noexcept { for (const std::unique_ptr<Decoration<POS>> &deco : decorationList) { @@ -263,7 +255,7 @@ int DecorationList<POS>::AllOnFor(Sci::Position position) const noexcept { for (const std::unique_ptr<Decoration<POS>> &deco : decorationList) { if (deco->rs.ValueAt(static_cast<POS>(position))) { if (deco->Indicator() < static_cast<int>(Scintilla::IndicatorNumbers::Ime)) { - mask |= 1 << deco->Indicator(); + mask |= 1u << deco->Indicator(); } } } Modified: scintilla/src/Document.cxx 23 lines changed, 16 insertions(+), 7 deletions(-) =================================================================== @@ -51,6 +51,16 @@ using namespace Scintilla; using namespace Scintilla::Internal; +LexInterface::LexInterface(Document *pdoc_) noexcept : pdoc(pdoc_), performingStyle(false) { +} + +LexInterface::~LexInterface() noexcept = default; + +void LexInterface::SetInstance(ILexer5 *instance_) { + instance.reset(instance_); + pdoc->LexerChanged(); +} + void LexInterface::Colourise(Sci::Position start, Sci::Position end) { if (pdoc && instance && !performingStyle) { // Protect against reentrance, which may occur, for example, when @@ -86,6 +96,10 @@ LineEndType LexInterface::LineEndTypesSupported() { return LineEndType::Default; } +bool LexInterface::UseContainerLexing() const noexcept { + return !instance; +} + ActionDuration::ActionDuration(double duration_, double minDuration_, double maxDuration_) noexcept : duration(duration_), minDuration(minDuration_), maxDuration(maxDuration_) { } @@ -2067,7 +2081,7 @@ Sci::Position Document::FindText(Sci::Position minPos, Sci::Position maxPos, con const unsigned char charStartSearch = search[0]; if (forward && ((0 == dbcsCodePage) || (CpUtf8 == dbcsCodePage && !UTF8IsTrailByte(charStartSearch)))) { // This is a fast case where there is no need to test byte values to iterate - // so becomes the equivalent of a memchr+memcmp loop. + // so becomes the equivalent of a memchr+memcmp loop. // UTF-8 search will not be self-synchronizing when starts with trail byte const std::string_view suffix(search + 1, lengthFind - 1); while (pos < endSearch) { @@ -2798,11 +2812,6 @@ Sci::Position Document::BraceMatch(Sci::Position position, Sci::Position /*maxRe class BuiltinRegex : public RegexSearchBase { public: explicit BuiltinRegex(CharClassify *charClassTable) : search(charClassTable) {} - BuiltinRegex(const BuiltinRegex &) = delete; - BuiltinRegex(BuiltinRegex &&) = delete; - BuiltinRegex &operator=(const BuiltinRegex &) = delete; - BuiltinRegex &operator=(BuiltinRegex &&) = delete; - ~BuiltinRegex() override = default; Sci::Position FindText(Document *doc, Sci::Position minPos, Sci::Position maxPos, const char *s, bool caseSensitive, bool word, bool wordStart, FindOption flags, @@ -3199,7 +3208,7 @@ bool MatchOnLines(const Document *doc, const Regex ®exp, const RESearchRange } #endif if (matched) { - for (size_t co = 0; co < match.size(); co++) { + for (size_t co = 0; co < match.size() && co < RESearch::MAXTAG; co++) { search.bopat[co] = match[co].first.Pos(); search.eopat[co] = match[co].second.PosRoundUp(); const Sci::Position lenMatch = search.eopat[co] - search.bopat[co]; Modified: scintilla/src/Document.h 38 lines changed, 29 insertions(+), 9 deletions(-) =================================================================== @@ -90,7 +90,7 @@ class Range { */ class RegexSearchBase { public: - virtual ~RegexSearchBase() {} + virtual ~RegexSearchBase() = default; virtual Sci::Position FindText(Document *doc, Sci::Position minPos, Sci::Position maxPos, const char *s, bool caseSensitive, bool word, bool wordStart, Scintilla::FindOption flags, Sci::Position *length) = 0; @@ -164,21 +164,41 @@ class HighlightDelimiter { bool isEnabled; }; +struct LexerReleaser { + // Called by unique_ptr to destroy/free the Resource + void operator()(Scintilla::ILexer5 *pLexer) noexcept { + if (pLexer) { + try { + pLexer->Release(); + } catch (...) { + // ILexer5::Release must not throw, ignore if it does. + } + } + } +}; + +using LexerInstance = std::unique_ptr<Scintilla::ILexer5, LexerReleaser>; + +// LexInterface defines the interface to ILexer used in Document. +// The LexState subclass is actually created and that is used within ScintillaBase +// to provide more methods that are exposed through Scintilla's external API. class LexInterface { protected: Document *pdoc; - Scintilla::ILexer5 *instance; + LexerInstance instance; bool performingStyle; ///< Prevent reentrance public: - explicit LexInterface(Document *pdoc_) noexcept : pdoc(pdoc_), instance(nullptr), performingStyle(false) { - } - virtual ~LexInterface() { - } + explicit LexInterface(Document *pdoc_) noexcept; + // Deleted so LexInterface objects can not be copied. + LexInterface(const LexInterface &) = delete; + LexInterface(LexInterface &&) = delete; + LexInterface &operator=(const LexInterface &) = delete; + LexInterface &operator=(LexInterface &&) = delete; + virtual ~LexInterface() noexcept; + void SetInstance(ILexer5 *instance_); void Colourise(Sci::Position start, Sci::Position end); virtual Scintilla::LineEndType LineEndTypesSupported(); - bool UseContainerLexing() const noexcept { - return instance == nullptr; - } + bool UseContainerLexing() const noexcept; }; struct RegexError : public std::runtime_error { Modified: scintilla/src/EditModel.cxx 1 lines changed, 1 insertions(+), 0 deletions(-) =================================================================== @@ -7,6 +7,7 @@ #include <cstddef> #include <cstdlib> +#include <cstdint> #include <cassert> #include <cstring> #include <cmath> Modified: scintilla/src/EditModel.h 1 lines changed, 0 insertions(+), 1 deletions(-) =================================================================== @@ -64,7 +64,6 @@ class EditModel { virtual Sci::Line TopLineOfMain() const = 0; virtual Point GetVisibleOriginInMain() const = 0; virtual Sci::Line LinesOnScreen() const = 0; - virtual Range GetHotSpotRange() const noexcept = 0; bool BidirectionalEnabled() const noexcept; bool BidirectionalR2L() const noexcept; void SetDefaultFoldDisplayText(const char *text); Modified: scintilla/src/EditView.cxx 95 lines changed, 54 insertions(+), 41 deletions(-) =================================================================== @@ -7,6 +7,7 @@ #include <cstddef> #include <cstdlib> +#include <cstdint> #include <cassert> #include <cstring> #include <cstdio> @@ -951,19 +952,19 @@ static void DrawCaretLineFramed(Surface *surface, const ViewStyle &vsDraw, const // Avoid double drawing the corners by removing the left and right sides when drawing top and bottom borders const PRectangle rcWithoutLeftRight = rcLine.Inset(Point(width, 0.0)); - if (subLine == 0 || ll->wrapIndent == 0 || vsDraw.caretLine.layer != Layer::Base) { + if (subLine == 0 || ll->wrapIndent == 0 || vsDraw.caretLine.layer != Layer::Base || vsDraw.caretLine.subLine) { // Left surface->FillRectangleAligned(Side(rcLine, Edge::left, width), colourFrame); } - if (subLine == 0) { + if (subLine == 0 || vsDraw.caretLine.subLine) { // Top surface->FillRectangleAligned(Side(rcWithoutLeftRight, Edge::top, width), colourFrame); } - if (subLine == ll->lines - 1 || vsDraw.caretLine.layer != Layer::Base) { + if (subLine == ll->lines - 1 || vsDraw.caretLine.layer != Layer::Base || vsDraw.caretLine.subLine) { // Right surface->FillRectangleAligned(Side(rcLine, Edge::right, width), colourFrame); } - if (subLine == ll->lines - 1) { + if (subLine == ll->lines - 1 || vsDraw.caretLine.subLine) { // Bottom surface->FillRectangleAligned(Side(rcWithoutLeftRight, Edge::bottom, width), colourFrame); } @@ -1458,7 +1459,7 @@ void EditView::DrawEOLAnnotationText(Surface *surface, const EditModel &model, c } } - // For multi-phase drawing draw the text last as transparent over any box + // For multi-phase drawing draw the text last as transparent over any box if (FlagSet(phase, DrawPhase::text)) { if (phasesDraw != PhasesDraw::One) { surface->DrawTextTransparentUTF8(rcText, fontText, @@ -1603,7 +1604,7 @@ void EditView::DrawCarets(Surface *surface, const EditModel &model, const ViewSt for (size_t r = 0; (r<model.sel.Count()) || drawDrag; r++) { const bool mainCaret = r == model.sel.Main(); SelectionPosition posCaret = (drawDrag ? model.posDrag : model.sel.Range(r).caret); - if ((vsDraw.DrawCaretInsideSelection(model.inOverstrike, imeCaretBlockOverride)) && + if ((vsDraw.DrawCaretInsideSelection(model.inOverstrike, imeCaretBlockOverride)) && !drawDrag && posCaret > model.sel.Range(r).anchor) { if (posCaret.VirtualSpace() > 0) @@ -1766,7 +1767,7 @@ void EditView::DrawBackground(Surface *surface, const EditModel &model, const Vi rcSegment.right = rcLine.right; const InSelection inSelection = hideSelection ? InSelection::inNone : model.sel.CharacterInSelection(iDoc); - const bool inHotspot = (ll->hotspot.Valid()) && ll->hotspot.ContainsCharacter(iDoc); + const bool inHotspot = model.hotspot.Valid() && model.hotspot.ContainsCharacter(iDoc); ColourRGBA textBack = TextBackground(model, vsDraw, ll, background, inSelection, inHotspot, ll->styles[i], i); if (ts.representation) { @@ -1977,7 +1978,7 @@ void EditView::DrawForeground(Surface *surface, const EditModel &model, const Vi ColourRGBA textFore = vsDraw.styles[styleMain].fore; const Font *textFont = vsDraw.styles[styleMain].font.get(); // Hot-spot foreground - const bool inHotspot = (ll->hotspot.Valid()) && ll->hotspot.ContainsCharacter(iDoc); + const bool inHotspot = model.hotspot.Valid() && model.hotspot.ContainsCharacter(iDoc); if (inHotspot) { if (vsDraw.ElementColour(Element::HotSpotActive)) textFore = *vsDraw.ElementColour(Element::HotSpotActive); @@ -2124,7 +2125,7 @@ void EditView::DrawForeground(Surface *surface, const EditModel &model, const Vi } } } - if (ll->hotspot.Valid() && vsDraw.hotspotUnderline && ll->hotspot.ContainsCharacter(iDoc)) { + if (inHotspot && vsDraw.hotspotUnderline) { PRectangle rcUL = rcSegment; rcUL.top = rcUL.top + vsDraw.maxAscent + 1; rcUL.bottom = rcUL.top + 1; @@ -2281,27 +2282,40 @@ void EditView::DrawLine(Surface *surface, const EditModel &model, const ViewStyl } } -static void DrawFoldLines(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, Sci::Line line, PRectangle rcLine) { +static void DrawFoldLines(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, + Sci::Line line, PRectangle rcLine, int subLine) { + const bool lastSubLine = subLine == (ll->lines - 1); const bool expanded = model.pcs->GetExpanded(line); const FoldLevel level = model.pdoc->GetFoldLevel(line); const FoldLevel levelNext = model.pdoc->GetFoldLevel(line + 1); if (LevelIsHeader(level) && (LevelNumber(level) < LevelNumber(levelNext))) { + const ColourRGBA foldLineColour = vsDraw.ElementColour(Element::FoldLine).value_or( + vsDraw.styles[StyleDefault].fore); // Paint the line above the fold - if ((expanded && (FlagSet(model.foldFlags, FoldFlag::LineBeforeExpanded))) + if ((subLine == 0) && + ((expanded && (FlagSet(model.foldFlags, FoldFlag::LineBeforeExpanded))) || - (!expanded && (FlagSet(model.foldFlags, FoldFlag::LineBeforeContracted)))) { - PRectangle rcFoldLine = rcLine; - rcFoldLine.bottom = rcFoldLine.top + 1; - surface->FillRectangleAligned(rcFoldLine, Fill(vsDraw.styles[StyleDefault].fore)); + (!expanded && (FlagSet(model.foldFlags, FoldFlag::LineBeforeContracted))))) { + surface->FillRectangleAligned(Side(rcLine, Edge::top, 1.0), foldLineColour); } // Paint the line below the fold - if ((expanded && (FlagSet(model.foldFlags, FoldFlag::LineAfterExpanded))) + if (lastSubLine && + ((expanded && (FlagSet(model.foldFlags, FoldFlag::LineAfterExpanded))) || - (!expanded && (FlagSet(model.foldFlags, FoldFlag::LineAfterContracted)))) { - PRectangle rcFoldLine = rcLine; - rcFoldLine.top = rcFoldLine.bottom - 1; - surface->FillRectangleAligned(rcFoldLine, Fill(vsDraw.styles[StyleDefault].fore)); + (!expanded && (FlagSet(model.foldFlags, FoldFlag::LineAfterContracted))))) { + surface->FillRectangleAligned(Side(rcLine, Edge::bottom, 1.0), foldLineColour); + // If contracted fold line drawn then don't overwrite with hidden line + // as fold lines are more specific then hidden lines. + if (!expanded) { + return; + } + } + } + if (lastSubLine && model.pcs->GetVisible(line) && !model.pcs->GetVisible(line + 1)) { + std::optional<ColourRGBA> hiddenLineColour = vsDraw.ElementColour(Element::HiddenLine); + if (hiddenLineColour) { + surface->FillRectangleAligned(Side(rcLine, Edge::bottom, 1.0), *hiddenLineColour); } } } @@ -2327,10 +2341,9 @@ void EditView::PaintText(Surface *surfaceWindow, const EditModel &model, PRectan const int screenLinePaintFirst = static_cast<int>(rcArea.top) / vsDraw.lineHeight; const int xStart = vsDraw.textStart - model.xOffset + static_cast<int>(ptOrigin.x); - SelectionPosition posCaret = model.sel.RangeMain().caret; - if (model.posDrag.IsValid()) - posCaret = model.posDrag; + const SelectionPosition posCaret = model.posDrag.IsValid() ? model.posDrag : model.sel.RangeMain().caret; const Sci::Line lineCaret = model.pdoc->SciLineFromPosition(posCaret.Position()); + const int caretOffset = static_cast<int>(posCaret.Position() - model.pdoc->LineStart(lineCaret)); PRectangle rcTextArea = rcClient; if (vsDraw.marginInside) { @@ -2397,8 +2410,8 @@ void EditView::PaintText(Surface *surfaceWindow, const EditModel &model, PRectan durLayout += ep.Duration(true); #endif if (ll) { - ll->containsCaret = !hideSelection && (lineDoc == lineCaret); - ll->hotspot = model.GetHotSpotRange(); + ll->containsCaret = !hideSelection && (lineDoc == lineCaret) + && (ll->lines == 1 || !vsDraw.caretLine.subLine || ll->InLine(caretOffset, subLine)); PRectangle rcLine = rcTextArea; rcLine.top = static_cast<XYPOSITION>(ypos); @@ -2432,7 +2445,7 @@ void EditView::PaintText(Surface *surfaceWindow, const EditModel &model, PRectan ll->RestoreBracesHighlight(rangeLine, model.braces, bracesIgnoreStyle); if (FlagSet(phase, DrawPhase::foldLines)) { - DrawFoldLines(surface, model, vsDraw, lineDoc, rcLine); + DrawFoldLines(surface, model, vsDraw, ll.get(), lineDoc, rcLine, subLine); } if (FlagSet(phase, DrawPhase::carets)) { @@ -2578,24 +2591,24 @@ Sci::Position EditView::FormatRange(bool draw, const RangeToFormat *pfr, Surface vsPrint.braceBadLightIndicatorSet = false; // Set colours for printing according to users settings - for (size_t sty = 0; sty < vsPrint.styles.size(); sty++) { - if (printParameters.colourMode == PrintOption::InvertLight) { - vsPrint.styles[sty].fore = InvertedLight(vsPrint.styles[sty].fore); - vsPrint.styles[sty].back = InvertedLight(vsPrint.styles[sty].back); - } else if (printParameters.colourMode == PrintOption::BlackOnWhite) { - vsPrint.styles[sty].fore = ColourRGBA(0, 0, 0); - vsPrint.styles[sty].back = ColourRGBA(0xff, 0xff, 0xff); - } else if (printParameters.colourMode == PrintOption::ColourOnWhite) { - vsPrint.styles[sty].back = ColourRGBA(0xff, 0xff, 0xff); - } else if (printParameters.colourMode == PrintOption::ColourOnWhiteDefaultBG) { - if (sty <= StyleDefault) { - vsPrint.styles[sty].back = ColourRGBA(0xff, 0xff, 0xff); - } + const PrintOption colourMode = printParameters.colourMode; + const std::vector<Style>::iterator endStyles = (colourMode == PrintOption::ColourOnWhiteDefaultBG) ? + vsPrint.styles.begin() + StyleLineNumber : vsPrint.styles.end(); + for (std::vector<Style>::iterator it = vsPrint.styles.begin(); it != endStyles; ++it) { + if (colourMode == PrintOption::InvertLight) { + it->fore = InvertedLight(it->fore); + it->back = InvertedLight(it->back); + } else if (colourMode == PrintOption::BlackOnWhite) { + it->fore = ColourRGBA(0, 0, 0); + it->back = ColourRGBA(0xff, 0xff, 0xff); + } else if (colourMode == PrintOption::ColourOnWhite || colourMode == PrintOption::ColourOnWhiteDefaultBG) { + it->back = ColourRGBA(0xff, 0xff, 0xff); } } // White background for the line numbers if PrintOption::ScreenColours isn't used - if (printParameters.colourMode != PrintOption::ScreenColours) + if (colourMode != PrintOption::ScreenColours) { vsPrint.styles[StyleLineNumber].back = ColourRGBA(0xff, 0xff, 0xff); + } // Printing uses different margins, so reset screen margins vsPrint.leftMarginWidth = 0; @@ -2688,7 +2701,7 @@ Sci::Position EditView::FormatRange(bool draw, const RangeToFormat *pfr, Surface vsPrint.styles[StyleLineNumber].font.get(), number); surface->FlushCachedState(); surface->DrawTextNoClip(rcNumber, vsPrint.styles[StyleLineNumber].font.get(), - static_cast<XYPOSITION>(ypos + vsPrint.maxAscent), number, + ypos + vsPrint.maxAscent, number, vsPrint.styles[StyleLineNumber].fore, vsPrint.styles[StyleLineNumber].back); } Modified: scintilla/src/Editor.cxx 48 lines changed, 38 insertions(+), 10 deletions(-) =================================================================== @@ -7,6 +7,7 @@ #include <cstddef> #include <cstdlib> +#include <cstdint> #include <cassert> #include <cstring> #include <cstdio> @@ -117,7 +118,7 @@ static constexpr bool IsAllSpacesOrTabs(std::string_view sv) noexcept { return true; } -Editor::Editor() : durationWrapOneByte(0.000001, 0.0000001, 0.00001) { +Editor::Editor() : durationWrapOneByte(0.000001, 0.00000001, 0.00001) { ctrlID = 0; stylesValid = false; @@ -479,12 +480,17 @@ void Editor::DiscardOverdraw() { } void Editor::Redraw() { + if (redrawPendingText) { + return; + } //Platform::DebugPrintf("Redraw all\n"); const PRectangle rcClient = GetClientRectangle(); wMain.InvalidateRectangle(rcClient); - if (wMargin.GetID()) + if (wMargin.GetID()) { wMargin.InvalidateAll(); - //wMain.InvalidateAll(); + } else if (paintState == PaintState::notPainting) { + redrawPendingText = true; + } } void Editor::RedrawSelMargin(Sci::Line line, bool allAfter) { @@ -498,11 +504,15 @@ void Editor::RedrawSelMargin(Sci::Line line, bool allAfter) { Redraw(); return; } + if (redrawPendingMargin) { + return; + } PRectangle rcMarkers = GetClientRectangle(); if (!markersInText) { // Normal case: just draw the margin rcMarkers.right = rcMarkers.left + vs.fixedColumnWidth; } + const PRectangle rcMarkersFull = rcMarkers; if (line != -1) { PRectangle rcLine = RectangleFromRange(Range(pdoc->LineStart(line)), 0); @@ -529,6 +539,9 @@ void Editor::RedrawSelMargin(Sci::Line line, bool allAfter) { wMargin.InvalidateRectangle(rcMarkers); } else { wMain.InvalidateRectangle(rcMarkers); + if (rcMarkers == rcMarkersFull) { + redrawPendingMargin = true; + } } } @@ -552,6 +565,9 @@ PRectangle Editor::RectangleFromRange(Range r, int overlap) { } void Editor::InvalidateRange(Sci::Position start, Sci::Position end) { + if (redrawPendingText) { + return; + } RedrawRect(RectangleFromRange(Range(start, end), view.LinesOverlap() ? vs.lineOverlap : 0)); } @@ -1717,6 +1733,9 @@ void Editor::RefreshPixMaps(Surface *surfaceWindow) { } void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) { + redrawPendingText = false; + redrawPendingMargin = false; + //Platform::DebugPrintf("Paint:%1d (%3d,%3d) ... (%3d,%3d)\n", // paintingAllText, rcArea.left, rcArea.top, rcArea.right, rcArea.bottom); @@ -4780,10 +4799,6 @@ void Editor::SetHotSpotRange(const Point *pt) { } } -Range Editor::GetHotSpotRange() const noexcept { - return hotspot; -} - void Editor::ButtonMoveWithModifiers(Point pt, unsigned int, KeyMod modifiers) { if (ptMouseLast != pt) { DwellEnd(true); @@ -5748,6 +5763,9 @@ void Editor::StyleSetMessage(Message iMessage, uptr_t wParam, sptr_t lParam) { case Message::StyleSetHotSpot: vs.styles[wParam].hotspot = lParam != 0; break; + case Message::StyleSetCheckMonospaced: + vs.styles[wParam].checkMonospaced = lParam != 0; + break; default: break; } @@ -5787,6 +5805,8 @@ sptr_t Editor::StyleGetMessage(Message iMessage, uptr_t wParam, sptr_t lParam) { return vs.styles[wParam].changeable ? 1 : 0; case Message::StyleGetHotSpot: return vs.styles[wParam].hotspot ? 1 : 0; + case Message::StyleGetCheckMonospaced: + return vs.styles[wParam].checkMonospaced ? 1 : 0; default: break; } @@ -7202,6 +7222,7 @@ sptr_t Editor::WndProc(Message iMessage, uptr_t wParam, sptr_t lParam) { case Message::StyleSetVisible: case Message::StyleSetChangeable: case Message::StyleSetHotSpot: + case Message::StyleSetCheckMonospaced: StyleSetMessage(iMessage, wParam, lParam); break; @@ -7220,6 +7241,7 @@ sptr_t Editor::WndProc(Message iMessage, uptr_t wParam, sptr_t lParam) { case Message::StyleGetVisible: case Message::StyleGetChangeable: case Message::StyleGetHotSpot: + case Message::StyleGetCheckMonospaced: return StyleGetMessage(iMessage, wParam, lParam); case Message::StyleResetDefault: @@ -7300,6 +7322,13 @@ sptr_t Editor::WndProc(Message iMessage, uptr_t wParam, sptr_t lParam) { InvalidateStyleRedraw(); break; + case Message::GetCaretLineHighlightSubLine: + return vs.caretLine.subLine; + case Message::SetCaretLineHighlightSubLine: + vs.caretLine.subLine = wParam != 0; + InvalidateStyleRedraw(); + break; + case Message::GetCaretLineFrame: return vs.caretLine.frame; case Message::SetCaretLineFrame: @@ -7377,8 +7406,7 @@ sptr_t Editor::WndProc(Message iMessage, uptr_t wParam, sptr_t lParam) { break; case Message::HideLines: - if (wParam > 0) - pcs->SetVisible(LineFromUPtr(wParam), lParam, false); + pcs->SetVisible(LineFromUPtr(wParam), lParam, false); SetScrollBars(); Redraw(); break; @@ -7903,7 +7931,7 @@ sptr_t Editor::WndProc(Message iMessage, uptr_t wParam, sptr_t lParam) { break; case Message::MultiEdgeAddLine: - vs.AddMultiEdge(wParam, lParam); + vs.AddMultiEdge(static_cast<int>(wParam), ColourRGBA::FromIpRGB(lParam)); InvalidateStyleRedraw(); break; Modified: scintilla/src/Editor.h 7 lines changed, 5 insertions(+), 2 deletions(-) =================================================================== @@ -188,6 +188,10 @@ class Editor : public EditModel, public DocWatcher { Window wMain; ///< The Scintilla parent window Window wMargin; ///< May be separate when using a scroll view for wMain + // Optimization that avoids superfluous invalidations + bool redrawPendingText = false; + bool redrawPendingMargin = false; + /** Style resources may be expensive to allocate so are cached between uses. * When a style attribute is changed, this cache is flushed. */ bool stylesValid; @@ -581,7 +585,6 @@ class Editor : public EditModel, public DocWatcher { bool PositionIsHotspot(Sci::Position position) const; bool PointIsHotspot(Point pt); void SetHotSpotRange(const Point *pt); - Range GetHotSpotRange() const noexcept override; void SetHoverIndicatorPosition(Sci::Position position); void SetHoverIndicatorPoint(Point pt); @@ -637,7 +640,7 @@ class Editor : public EditModel, public DocWatcher { return Point(static_cast<XYPOSITION>(wParam) - vs.ExternalMarginWidth(), static_cast<XYPOSITION>(lParam)); } - constexpr std::optional<FoldLevel> OptionalFoldLevel(Scintilla::sptr_t lParam) { + static constexpr std::optional<FoldLevel> OptionalFoldLevel(Scintilla::sptr_t lParam) { if (lParam >= 0) { return static_cast<FoldLevel>(lParam); } Modified: scintilla/src/Geometry.cxx 24 lines changed, 24 insertions(+), 0 deletions(-) =================================================================== @@ -12,6 +12,14 @@ #include "Geometry.h" +namespace { + +constexpr unsigned int Mixed(unsigned char a, unsigned char b, double proportion) noexcept { + return static_cast<unsigned int>(a + proportion * (b - a)); +} + +} + namespace Scintilla::Internal { PRectangle Clamp(PRectangle rc, Edge edge, XYPOSITION position) noexcept { @@ -95,4 +103,20 @@ PRectangle PixelAlignOutside(const PRectangle &rc, int pixelDivisions) noexcept std::floor(rc.bottom * pixelDivisions) / pixelDivisions); } +ColourRGBA ColourRGBA::MixedWith(ColourRGBA other) const noexcept { + const unsigned int red = (GetRed() + other.GetRed()) / 2; + const unsigned int green = (GetGreen() + other.GetGreen()) / 2; + const unsigned int blue = (GetBlue() + other.GetBlue()) / 2; + const unsigned int alpha = (GetAlpha() + other.GetAlpha()) / 2; + return ColourRGBA(red, green, blue, alpha); +} + +ColourRGBA ColourRGBA::MixedWith(ColourRGBA other, double proportion) const noexcept { + return ColourRGBA( + Mixed(GetRed(), other.GetRed(), proportion), + Mixed(GetGreen(), other.GetGreen(), proportion), + Mixed(GetBlue(), other.GetBlue(), proportion), + Mixed(GetAlpha(), other.GetAlpha(), proportion)); +} + } Modified: scintilla/src/Geometry.h 28 lines changed, 6 insertions(+), 22 deletions(-) =================================================================== @@ -161,9 +161,6 @@ PRectangle PixelAlignOutside(const PRectangle &rc, int pixelDivisions) noexcept; constexpr const float componentMaximum = 255.0f; class ColourRGBA { int co; - constexpr static unsigned int Mixed(unsigned char a, unsigned char b, double proportion) noexcept { - return static_cast<unsigned int>(a + proportion * (b - a)); - } public: constexpr explicit ColourRGBA(int co_ = 0) noexcept : co(co_) { } @@ -236,21 +233,8 @@ class ColourRGBA { return GetAlpha() == 0xff; } - constexpr ColourRGBA MixedWith(ColourRGBA other) const noexcept { - const unsigned int red = (GetRed() + other.GetRed()) / 2; - const unsigned int green = (GetGreen() + other.GetGreen()) / 2; - const unsigned int blue = (GetBlue() + other.GetBlue()) / 2; - const unsigned int alpha = (GetAlpha() + other.GetAlpha()) / 2; - return ColourRGBA(red, green, blue, alpha); - } - - constexpr ColourRGBA MixedWith(ColourRGBA other, double proportion) const noexcept { - return ColourRGBA( - Mixed(GetRed(), other.GetRed(), proportion), - Mixed(GetGreen(), other.GetGreen(), proportion), - Mixed(GetBlue(), other.GetBlue(), proportion), - Mixed(GetAlpha(), other.GetAlpha(), proportion)); - } + ColourRGBA MixedWith(ColourRGBA other) const noexcept; + ColourRGBA MixedWith(ColourRGBA other, double proportion) const noexcept; }; /** @@ -260,7 +244,7 @@ class Stroke { public: ColourRGBA colour; XYPOSITION width; - constexpr Stroke(ColourRGBA colour_, XYPOSITION width_=1.0) noexcept : + constexpr Stroke(ColourRGBA colour_, XYPOSITION width_=1.0) noexcept : colour(colour_), width(width_) { } constexpr float WidthF() const noexcept { @@ -274,7 +258,7 @@ class Stroke { class Fill { public: ColourRGBA colour; - constexpr Fill(ColourRGBA colour_) noexcept : + constexpr Fill(ColourRGBA colour_) noexcept : colour(colour_) { } }; @@ -286,10 +270,10 @@ class FillStroke { public: Fill fill; Stroke stroke; - constexpr FillStroke(ColourRGBA colourFill_, ColourRGBA colourStroke_, XYPOSITION widthStroke_=1.0) noexcept : + constexpr FillStroke(ColourRGBA colourFill_, ColourRGBA colourStroke_, XYPOSITION widthStroke_=1.0) noexcept : fill(colourFill_), stroke(colourStroke_, widthStroke_) { } - constexpr FillStroke(ColourRGBA colourBoth, XYPOSITION widthStroke_=1.0) noexcept : + constexpr FillStroke(ColourRGBA colourBoth, XYPOSITION widthStroke_=1.0) noexcept : fill(colourBoth), stroke(colourBoth, widthStroke_) { } }; Modified: scintilla/src/Indicator.cxx 4 lines changed, 2 insertions(+), 2 deletions(-) =================================================================== @@ -47,7 +47,7 @@ void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &r const XYPOSITION ymid = PixelAlign(rc.Centre().y, pixelDivisions); - // This is a reasonable clip for indicators beneath text like underlines + // This is a reasonable clip for indicators beneath text like underlines PRectangle rcClip = rcAligned; rcClip.bottom = rcFullHeightAligned.bottom; @@ -242,7 +242,7 @@ void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &r const XYPOSITION widthDot = std::round(strokeWidth); XYPOSITION x = std::floor(rc.left); while (x < rc.right) { - const PRectangle rcDot = PRectangle(x, ymid, + const PRectangle rcDot = PRectangle(x, ymid, x + widthDot, ymid + widthDot); surface->FillRectangle(rcDot, sacDraw.fore); x += widthDot * 2; Modified: scintilla/src/KeyMap.cxx 4 lines changed, 0 insertions(+), 4 deletions(-) =================================================================== @@ -32,10 +32,6 @@ KeyMap::KeyMap() { } } -KeyMap::~KeyMap() { - Clear(); -} - void KeyMap::Clear() noexcept { kmap.clear(); } Modified: scintilla/src/KeyMap.h 1 lines changed, 0 insertions(+), 1 deletions(-) =================================================================== @@ -52,7 +52,6 @@ class KeyMap { public: KeyMap(); - ~KeyMap(); void Clear() noexcept; void AssignCmdKey(Scintilla::Keys key, Scintilla::KeyMod modifiers, Scintilla::Message msg); Scintilla::Message Find(Scintilla::Keys key, Scintilla::KeyMod modifiers) const; // 0 returned on failure Modified: scintilla/src/LineMarker.cxx 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -326,7 +326,7 @@ void LineMarker::DrawFoldingMark(Surface *surface, const PRectangle &rcWhole, Fo void LineMarker::AlignedPolygon(Surface *surface, const Point *pts, size_t npts) const { const XYPOSITION move = strokeWidth / 2.0; std::vector<Point> points; - std::transform(pts, pts + npts, std::back_inserter(points), [=](Point pt)->Point { + std::transform(pts, pts + npts, std::back_inserter(points), [=](Point pt) noexcept ->Point { return Point(pt.x + move, pt.y + move); }); surface->Polygon(points.data(), std::size(points), FillStroke(back, fore, strokeWidth)); Modified: scintilla/src/MarginView.cxx 528 lines changed, 274 insertions(+), 254 deletions(-) =================================================================== @@ -7,6 +7,7 @@ #include <cstddef> #include <cstdlib> +#include <cstdint> #include <cassert> #include <cstring> #include <cstdio> @@ -166,301 +167,320 @@ void MarginView::RefreshPixMaps(Surface *surfaceWindow, const ViewStyle &vsDraw) } } -static MarkerOutline SubstituteMarkerIfEmpty(MarkerOutline markerCheck, MarkerOutline markerDefault, const ViewStyle &vs) noexcept { +namespace { + +MarkerOutline SubstituteMarkerIfEmpty(MarkerOutline markerCheck, MarkerOutline markerDefault, const ViewStyle &vs) noexcept { if (vs.markers[static_cast<size_t>(markerCheck)].markType == MarkerSymbol::Empty) return markerDefault; return markerCheck; } +constexpr MarkerOutline TailFromNextLevel(FoldLevel levelNextNum) noexcept { + return (levelNextNum > FoldLevel::Base) ? MarkerOutline::FolderMidTail : MarkerOutline::FolderTail; +} + +int FoldingMark(FoldLevel level, FoldLevel levelNext, bool firstSubLine, bool lastSubLine, + bool isExpanded, bool needWhiteClosure, MarkerOutline folderOpenMid, MarkerOutline folderEnd) noexcept { + + const FoldLevel levelNum = LevelNumberPart(level); + const FoldLevel levelNextNum = LevelNumberPart(levelNext); + + if (LevelIsHeader(level)) { + if (firstSubLine) { + if (levelNum < levelNextNum) { + if (levelNum == FoldLevel::Base) { + return 1 << (isExpanded ? MarkerOutline::FolderOpen : MarkerOutline::Folder); + } else { + return 1 << (isExpanded ? folderOpenMid : folderEnd); + } + } else if (levelNum > FoldLevel::Base) { + return 1 << MarkerOutline::FolderSub; + } + } else { + if (levelNum < levelNextNum) { + if (isExpanded) { + return 1 << MarkerOutline::FolderSub; + } else if (levelNum > FoldLevel::Base) { + return 1 << MarkerOutline::FolderSub; + } + } else if (levelNum > FoldLevel::Base) { + return 1 << MarkerOutline::FolderSub; + } + } + } else if (LevelIsWhitespace(level)) { + if (needWhiteClosure) { + if (LevelIsWhitespace(levelNext)) { + return 1 << MarkerOutline::FolderSub; + } else { + return 1 << TailFromNextLevel(levelNextNum); + } + } else if (levelNum > FoldLevel::Base) { + if (levelNextNum < levelNum) { + return 1 << TailFromNextLevel(levelNextNum); + } else { + return 1 << MarkerOutline::FolderSub; + } + } + } else if (levelNum > FoldLevel::Base) { + if (levelNextNum < levelNum) { + if (LevelIsWhitespace(levelNext)) { + return 1 << MarkerOutline::FolderSub; + } else if (lastSubLine) { + return 1 << TailFromNextLevel(levelNextNum); + } else { + return 1 << MarkerOutline::FolderSub; + } + } else { + return 1 << MarkerOutline::FolderSub; + } + } + + // No folding mark on this line + return 0; +} + +} + +void MarginView::PaintOneMargin(Surface *surface, PRectangle rc, PRectangle rcOneMargin, const MarginStyle &marginStyle, + const EditModel &model, const ViewStyle &vs) { + const Point ptOrigin = model.GetVisibleOriginInMain(); + const Sci::Line lineStartPaint = static_cast<Sci::Line>(rcOneMargin.top + ptOrigin.y) / vs.lineHeight; + Sci::Line visibleLine = model.TopLineOfMain() + lineStartPaint; + XYPOSITION yposScreen = lineStartPaint * vs.lineHeight - ptOrigin.y; + // Work out whether the top line is whitespace located after a + // lessening of fold level which implies a 'fold tail' but which should not + // be displayed until the last of a sequence of whitespace. + bool needWhiteClosure = false; + if (marginStyle.ShowsFolding()) { + const FoldLevel level = model.pdoc->GetFoldLevel(model.pcs->DocFromDisplay(visibleLine)); + if (LevelIsWhitespace(level)) { + Sci::Line lineBack = model.pcs->DocFromDisplay(visibleLine); + FoldLevel levelPrev = level; + while ((lineBack > 0) && LevelIsWhitespace(levelPrev)) { + lineBack--; + levelPrev = model.pdoc->GetFoldLevel(lineBack); + } + if (!LevelIsHeader(levelPrev)) { + if (LevelNumber(level) < LevelNumber(levelPrev)) + needWhiteClosure = true; + } + } + } + + // Old code does not know about new markers needed to distinguish all cases + const MarkerOutline folderOpenMid = SubstituteMarkerIfEmpty(MarkerOutline::FolderOpenMid, + MarkerOutline::FolderOpen, vs); + const MarkerOutline folderEnd = SubstituteMarkerIfEmpty(MarkerOutline::FolderEnd, + MarkerOutline::Folder, vs); + + while ((visibleLine < model.pcs->LinesDisplayed()) && yposScreen < rc.bottom) { + + PLATFORM_ASSERT(visibleLine < model.pcs->LinesDisplayed()); + const Sci::Line lineDoc = model.pcs->DocFromDisplay(visibleLine); + PLATFORM_ASSERT((lineDoc == 0) || model.pcs->GetVisible(lineDoc)); + const Sci::Line firstVisibleLine = model.pcs->DisplayFromDoc(lineDoc); + const Sci::Line lastVisibleLine = model.pcs->DisplayLastFromDoc(lineDoc); + const bool firstSubLine = visibleLine == firstVisibleLine; + const bool lastSubLine = visibleLine == lastVisibleLine; + + int marks = firstSubLine ? model.pdoc->GetMark(lineDoc) : 0; + + bool headWithTail = false; + + if (marginStyle.ShowsFolding()) { + // Decide which fold indicator should be displayed + const FoldLevel level = model.pdoc->GetFoldLevel(lineDoc); + const FoldLevel levelNext = model.pdoc->GetFoldLevel(lineDoc + 1); + const FoldLevel levelNum = LevelNumberPart(level); + const FoldLevel levelNextNum = LevelNumberPart(levelNext); + const bool isExpanded = model.pcs->GetExpanded(lineDoc); + + marks |= FoldingMark(level, levelNext, firstSubLine, lastSubLine, + isExpanded, needWhiteClosure, folderOpenMid, folderEnd); + + // Change needWhiteClosure and headWithTail if needed + if (LevelIsHeader(level)) { + needWhiteClosure = false; + const Sci::Line firstFollowupLine = model.pcs->DocFromDisplay(model.pcs->DisplayFromDoc(lineDoc + 1)); + const FoldLevel firstFollowupLineLevel = model.pdoc->GetFoldLevel(firstFollowupLine); + const FoldLevel secondFollowupLineLevelNum = LevelNumberPart(model.pdoc->GetFoldLevel(firstFollowupLine + 1)); + if (!isExpanded) { + if (LevelIsWhitespace(firstFollowupLineLevel) && + (levelNum > secondFollowupLineLevelNum)) + needWhiteClosure = true; + + if (highlightDelimiter.IsFoldBlockHighlighted(firstFollowupLine)) + headWithTail = true; + } + } else if (LevelIsWhitespace(level)) { + if (needWhiteClosure) { + needWhiteClosure = LevelIsWhitespace(levelNext); + } + } else if (levelNum > FoldLevel::Base) { + if (levelNextNum < levelNum) { + needWhiteClosure = LevelIsWhitespace(levelNext); + } + } + } + + const PRectangle rcMarker( + rcOneMargin.left, + yposScreen, + rcOneMargin.right, + yposScreen + vs.lineHeight); + if (marginStyle.style == MarginType::Number) { + if (firstSubLine) { + std::string sNumber; + if (lineDoc >= 0) { + sNumber = std::to_string(lineDoc + 1); + } + if (FlagSet(model.foldFlags, (FoldFlag::LevelNumbers | FoldFlag::LineState))) { + char number[100] = ""; + if (FlagSet(model.foldFlags, FoldFlag::LevelNumbers)) { + const FoldLevel lev = model.pdoc->GetFoldLevel(lineDoc); + sprintf(number, "%c%c %03X %03X", + LevelIsHeader(lev) ? 'H' : '_', + LevelIsWhitespace(lev) ? 'W' : '_', + LevelNumber(lev), + static_cast<int>(lev) >> 16 + ); + } else { + const int state = model.pdoc->GetLineState(lineDoc); + sprintf(number, "%0X", state); + } + sNumber = number; + } + PRectangle rcNumber = rcMarker; + // Right justify + const XYPOSITION width = surface->WidthText(vs.styles[StyleLineNumber].font.get(), sNumber); + const XYPOSITION xpos = rcNumber.right - width - vs.marginNumberPadding; + rcNumber.left = xpos; + DrawTextNoClipPhase(surface, rcNumber, vs.styles[StyleLineNumber], + rcNumber.top + vs.maxAscent, sNumber, DrawPhase::all); + } else if (FlagSet(vs.wrap.visualFlags, WrapVisualFlag::Margin)) { + PRectangle rcWrapMarker = rcMarker; + rcWrapMarker.right -= wrapMarkerPaddingRight; + rcWrapMarker.left = rcWrapMarker.right - vs.styles[StyleLineNumber].aveCharWidth; + if (!customDrawWrapMarker) { + DrawWrapMarker(surface, rcWrapMarker, false, vs.styles[StyleLineNumber].fore); + } else { + customDrawWrapMarker(surface, rcWrapMarker, false, vs.styles[StyleLineNumber].fore); + } + } + } else if (marginStyle.style == MarginType::Text || marginStyle.style == MarginType::RText) { + const StyledText stMargin = model.pdoc->MarginStyledText(lineDoc); + if (stMargin.text && ValidStyledText(vs, vs.marginStyleOffset, stMargin)) { + if (firstSubLine) { + surface->FillRectangle(rcMarker, + vs.styles[stMargin.StyleAt(0) + vs.marginStyleOffset].back); + PRectangle rcText = rcMarker; + if (marginStyle.style == MarginType::RText) { + const int width = WidestLineWidth(surface, vs, vs.marginStyleOffset, stMargin); + rcText.left = rcText.right - width - 3; + } + DrawStyledText(surface, vs, vs.marginStyleOffset, rcText, + stMargin, 0, stMargin.length, DrawPhase::all); + } else { + // if we're displaying annotation lines, colour the margin to match the associated document line + const int annotationLines = model.pdoc->AnnotationLines(lineDoc); + if (annotationLines && (visibleLine > lastVisibleLine - annotationLines)) { + surface->FillRectangle(rcMarker, vs.styles[stMargin.StyleAt(0) + vs.marginStyleOffset].back); + } + } + } + } + + marks &= marginStyle.mask; + + if (marks) { + for (int markBit = 0; (markBit < 32) && marks; markBit++) { + if (marks & 1) { + LineMarker::FoldPart part = LineMarker::FoldPart::undefined; + if (marginStyle.ShowsFolding() && highlightDelimiter.IsFoldBlockHighlighted(lineDoc)) { + if (highlightDelimiter.IsBodyOfFoldBlock(lineDoc)) { + part = LineMarker::FoldPart::body; + } else if (highlightDelimiter.IsHeadOfFoldBlock(lineDoc)) { + if (firstSubLine) { + part = headWithTail ? LineMarker::FoldPart::headWithTail : LineMarker::FoldPart::head; + } else { + if (model.pcs->GetExpanded(lineDoc) || headWithTail) { + part = LineMarker::FoldPart::body; + } else { + part = LineMarker::FoldPart::undefined; + } + } + } else if (highlightDelimiter.IsTailOfFoldBlock(lineDoc)) { + part = LineMarker::FoldPart::tail; + } + } + vs.markers[markBit].Draw(surface, rcMarker, vs.styles[StyleLineNumber].font.get(), part, marginStyle.style); + } + marks >>= 1; + } + } + + visibleLine++; + yposScreen += vs.lineHeight; + } +} + void MarginView::PaintMargin(Surface *surface, Sci::Line topLine, PRectangle rc, PRectangle rcMargin, const EditModel &model, const ViewStyle &vs) { - PRectangle rcSelMargin = rcMargin; - rcSelMargin.right = rcMargin.left; - if (rcSelMargin.bottom < rc.bottom) - rcSelMargin.bottom = rc.bottom; + PRectangle rcOneMargin = rcMargin; + rcOneMargin.right = rcMargin.left; + if (rcOneMargin.bottom < rc.bottom) + rcOneMargin.bottom = rc.bottom; const Point ptOrigin = model.GetVisibleOriginInMain(); - const Font *fontLineNumber = vs.styles[StyleLineNumber].font.get(); - for (size_t margin = 0; margin < vs.ms.size(); margin++) { - if (vs.ms[margin].width > 0) { + for (const MarginStyle &marginStyle : vs.ms) { + if (marginStyle.width > 0) { - rcSelMargin.left = rcSelMargin.right; - rcSelMargin.right = rcSelMargin.left + vs.ms[margin].width; + rcOneMargin.left = rcOneMargin.right; + rcOneMargin.right = rcOneMargin.left + marginStyle.width; - if (vs.ms[margin].style != MarginType::Number) { - if (vs.ms[margin].ShowsFolding()) { + if (marginStyle.style != MarginType::Number) { + if (marginStyle.ShowsFolding()) { // Required because of special way brush is created for selection margin // Ensure patterns line up when scrolling with separate margin view // by choosing correctly aligned variant. const bool invertPhase = static_cast<int>(ptOrigin.y) & 1; - surface->FillRectangle(rcSelMargin, + surface->FillRectangle(rcOneMargin, invertPhase ? *pixmapSelPattern : *pixmapSelPatternOffset1); } else { ColourRGBA colour; - switch (vs.ms[margin].style) { + switch (marginStyle.style) { case MarginType::Back: colour = vs.styles[StyleDefault].back; break; case MarginType::Fore: colour = vs.styles[StyleDefault].fore; break; case MarginType::Colour: - colour = vs.ms[margin].back; + colour = marginStyle.back; break; default: colour = vs.styles[StyleLineNumber].back; break; } - surface->FillRectangle(rcSelMargin, colour); + surface->FillRectangle(rcOneMargin, colour); } } else { - surface->FillRectangle(rcSelMargin, vs.styles[StyleLineNumber].back); + surface->FillRectangle(rcOneMargin, vs.styles[StyleLineNumber].back); } - const Sci::Line lineStartPaint = static_cast<Sci::Line>(rcMargin.top + ptOrigin.y) / vs.lineHeight; - Sci::Line visibleLine = model.TopLineOfMain() + lineStartPaint; - Sci::Position yposScreen = lineStartPaint * vs.lineHeight - static_cast<Sci::Position>(ptOrigin.y); - // Work out whether the top line is whitespace located after a - // lessening of fold level which implies a 'fold tail' but which should not - // be displayed until the last of a sequence of whitespace. - bool needWhiteClosure = false; - if (vs.ms[margin].ShowsFolding()) { - const FoldLevel level = model.pdoc->GetFoldLevel(model.pcs->DocFromDisplay(visibleLine)); - if (LevelIsWhitespace(level)) { - Sci::Line lineBack = model.pcs->DocFromDisplay(visibleLine); - FoldLevel levelPrev = level; - while ((lineBack > 0) && LevelIsWhitespace(levelPrev)) { - lineBack--; - levelPrev = model.pdoc->GetFoldLevel(lineBack); - } - if (!LevelIsHeader(levelPrev)) { - if (LevelNumber(level) < LevelNumber(levelPrev)) - needWhiteClosure = true; - } - } - if (highlightDelimiter.isEnabled) { - const Sci::Line lastLine = model.pcs->DocFromDisplay(topLine + model.LinesOnScreen()) + 1; - model.pdoc->GetHighlightDelimiters(highlightDelimiter, - model.pdoc->SciLineFromPosition(model.sel.MainCaret()), lastLine); - } + if (marginStyle.ShowsFolding() && highlightDelimiter.isEnabled) { + const Sci::Line lastLine = model.pcs->DocFromDisplay(topLine + model.LinesOnScreen()) + 1; + model.pdoc->GetHighlightDelimiters(highlightDelimiter, + model.pdoc->SciLineFromPosition(model.sel.MainCaret()), lastLine); } - // Old code does not know about new markers needed to distinguish all cases - const MarkerOutline folderOpenMid = SubstituteMarkerIfEmpty(MarkerOutline::FolderOpenMid, - MarkerOutline::FolderOpen, vs); - const MarkerOutline folderEnd = SubstituteMarkerIfEmpty(MarkerOutline::FolderEnd, - MarkerOutline::Folder, vs); - - while ((visibleLine < model.pcs->LinesDisplayed()) && yposScreen < rc.bottom) { - - PLATFORM_ASSERT(visibleLine < model.pcs->LinesDisplayed()); - const Sci::Line lineDoc = model.pcs->DocFromDisplay(visibleLine); - PLATFORM_ASSERT(model.pcs->GetVisible(lineDoc)); - const Sci::Line firstVisibleLine = model.pcs->DisplayFromDoc(lineDoc); - const Sci::Line lastVisibleLine = model.pcs->DisplayLastFromDoc(lineDoc); - const bool firstSubLine = visibleLine == firstVisibleLine; - const bool lastSubLine = visibleLine == lastVisibleLine; - - int marks = model.pdoc->GetMark(lineDoc); - if (!firstSubLine) - marks = 0; - - bool headWithTail = false; - - if (vs.ms[margin].ShowsFolding()) { - // Decide which fold indicator should be displayed - const FoldLevel level = model.pdoc->GetFoldLevel(lineDoc); - const FoldLevel levelNext = model.pdoc->GetFoldLevel(lineDoc + 1); - const FoldLevel levelNum = LevelNumberPart(level); - const FoldLevel levelNextNum = LevelNumberPart(levelNext); - if (LevelIsHeader(level)) { - if (firstSubLine) { - if (levelNum < levelNextNum) { - if (model.pcs->GetExpanded(lineDoc)) { - if (levelNum == FoldLevel::Base) - marks |= 1 << MarkerOutline::FolderOpen; - else - marks |= 1 << folderOpenMid; - } else { - if (levelNum == FoldLevel::Base) - marks |= 1 << MarkerOutline::Folder; - else - marks |= 1 << folderEnd; - } - } else if (levelNum > FoldLevel::Base) { - marks |= 1 << MarkerOutline::FolderSub; - } - } else { - if (levelNum < levelNextNum) { - if (model.pcs->GetExpanded(lineDoc)) { - marks |= 1 << MarkerOutline::FolderSub; - } else if (levelNum > FoldLevel::Base) { - marks |= 1 << MarkerOutline::FolderSub; - } - } else if (levelNum > FoldLevel::Base) { - marks |= 1 << MarkerOutline::FolderSub; - } - } - needWhiteClosure = false; - const Sci::Line firstFollowupLine = model.pcs->DocFromDisplay(model.pcs->DisplayFromDoc(lineDoc + 1)); - const FoldLevel firstFollowupLineLevel = model.pdoc->GetFoldLevel(firstFollowupLine); - const FoldLevel secondFollowupLineLevelNum = LevelNumberPart(model.pdoc->GetFoldLevel(firstFollowupLine + 1)); - if (!model.pcs->GetExpanded(lineDoc)) { - if (LevelIsWhitespace(firstFollowupLineLevel) && - (levelNum > secondFollowupLineLevelNum)) - needWhiteClosure = true; - - if (highlightDelimiter.IsFoldBlockHighlighted(firstFollowupLine)) - headWithTail = true; - } - } else if (LevelIsWhitespace(level)) { - if (needWhiteClosure) { - if (LevelIsWhitespace(levelNext)) { - marks |= 1 << MarkerOutline::FolderSub; - } else if (levelNextNum > FoldLevel::Base) { - marks |= 1 << MarkerOutline::FolderMidTail; - needWhiteClosure = false; - } else { - marks |= 1 << MarkerOutline::FolderTail; - needWhiteClosure = false; - } - } else if (levelNum > FoldLevel::Base) { - if (levelNextNum < levelNum) { - if (levelNextNum > FoldLevel::Base) { - marks |= 1 << MarkerOutline::FolderMidTail; - } else { - marks |= 1 << MarkerOutline::FolderTail; - } - } else { - marks |= 1 << MarkerOutline::FolderSub; - } - } - } else if (levelNum > FoldLevel::Base) { - if (levelNextNum < levelNum) { - needWhiteClosure = false; - if (LevelIsWhitespace(levelNext)) { - marks |= 1 << MarkerOutline::FolderSub; - needWhiteClosure = true; - } else if (lastSubLine) { - if (levelNextNum > FoldLevel::Base) { - marks |= 1 << MarkerOutline::FolderMidTail; - } else { - marks |= 1 << MarkerOutline::FolderTail; - } - } else { - marks |= 1 << MarkerOutline::FolderSub; - } - } else { - marks |= 1 << MarkerOutline::FolderSub; - } - } - } - - marks &= vs.ms[margin].mask; - - const PRectangle rcMarker( - rcSelMargin.left, - static_cast<XYPOSITION>(yposScreen), - rcSelMargin.right, - static_cast<XYPOSITION>(yposScreen + vs.lineHeight)); - if (vs.ms[margin].style == MarginType::Number) { - if (firstSubLine) { - std::string sNumber; - if (lineDoc >= 0) { - sNumber = std::to_string(lineDoc + 1); - } - if (FlagSet(model.foldFlags, (FoldFlag::LevelNumbers | FoldFlag::LineState))) { - char number[100] = ""; - if (FlagSet(model.foldFlags, FoldFlag::LevelNumbers)) { - const FoldLevel lev = model.pdoc->GetFoldLevel(lineDoc); - sprintf(number, "%c%c %03X %03X", - LevelIsHeader(lev) ? 'H' : '_', - LevelIsWhitespace(lev) ? 'W' : '_', - LevelNumber(lev), - static_cast<int>(lev) >> 16 - ); - } else { - const int state = model.pdoc->GetLineState(lineDoc); - sprintf(number, "%0X", state); - } - sNumber = number; - } - PRectangle rcNumber = rcMarker; - // Right justify - const XYPOSITION width = surface->WidthText(fontLineNumber, sNumber); - const XYPOSITION xpos = rcNumber.right - width - vs.marginNumberPadding; - rcNumber.left = xpos; - DrawTextNoClipPhase(surface, rcNumber, vs.styles[StyleLineNumber], - rcNumber.top + vs.maxAscent, sNumber, DrawPhase::all); - } else if (FlagSet(vs.wrap.visualFlags, WrapVisualFlag::Margin)) { - PRectangle rcWrapMarker = rcMarker; - rcWrapMarker.right -= wrapMarkerPaddingRight; - rcWrapMarker.left = rcWrapMarker.right - vs.styles[StyleLineNumber].aveCharWidth; - if (!customDrawWrapMarker) { - DrawWrapMarker(surface, rcWrapMarker, false, vs.styles[StyleLineNumber].fore); - } else { - customDrawWrapMarker(surface, rcWrapMarker, false, vs.styles[StyleLineNumber].fore); - } - } - } else if (vs.ms[margin].style == MarginType::Text || vs.ms[margin].style == MarginType::RText) { - const StyledText stMargin = model.pdoc->MarginStyledText(lineDoc); - if (stMargin.text && ValidStyledText(vs, vs.marginStyleOffset, stMargin)) { - if (firstSubLine) { - surface->FillRectangle(rcMarker, - vs.styles[stMargin.StyleAt(0) + vs.marginStyleOffset].back); - PRectangle rcText = rcMarker; - if (vs.ms[margin].style == MarginType::RText) { - const int width = WidestLineWidth(surface, vs, vs.marginStyleOffset, stMargin); - rcText.left = rcText.right - width - 3; - } - DrawStyledText(surface, vs, vs.marginStyleOffset, rcText, - stMargin, 0, stMargin.length, DrawPhase::all); - } else { - // if we're displaying annotation lines, colour the margin to match the associated document line - const int annotationLines = model.pdoc->AnnotationLines(lineDoc); - if (annotationLines && (visibleLine > lastVisibleLine - annotationLines)) { - surface->FillRectangle(rcMarker, vs.styles[stMargin.StyleAt(0) + vs.marginStyleOffset].back); - } - } - } - } - - if (marks) { - for (int markBit = 0; (markBit < 32) && marks; markBit++) { - if (marks & 1) { - LineMarker::FoldPart part = LineMarker::FoldPart::undefined; - if (vs.ms[margin].ShowsFolding() && highlightDelimiter.IsFoldBlockHighlighted(lineDoc)) { - if (highlightDelimiter.IsBodyOfFoldBlock(lineDoc)) { - part = LineMarker::FoldPart::body; - } else if (highlightDelimiter.IsHeadOfFoldBlock(lineDoc)) { - if (firstSubLine) { - part = headWithTail ? LineMarker::FoldPart::headWithTail : LineMarker::FoldPart::head; - } else { - if (model.pcs->GetExpanded(lineDoc) || headWithTail) { - part = LineMarker::FoldPart::body; - } else { - part = LineMarker::FoldPart::undefined; - } - } - } else if (highlightDelimiter.IsTailOfFoldBlock(lineDoc)) { - part = LineMarker::FoldPart::tail; - } - } - vs.markers[markBit].Draw(surface, rcMarker, fontLineNumber, part, vs.ms[margin].style); - } - marks >>= 1; - } - } - - visibleLine++; - yposScreen += vs.lineHeight; - } + PaintOneMargin(surface, rc, rcOneMargin, marginStyle, model, vs); } } PRectangle rcBlankMargin = rcMargin; - rcBlankMargin.left = rcSelMargin.right; + rcBlankMargin.left = rcOneMargin.right; surface->FillRectangle(rcBlankMargin, vs.styles[StyleDefault].back); } Modified: scintilla/src/MarginView.h 2 lines changed, 2 insertions(+), 0 deletions(-) =================================================================== @@ -36,6 +36,8 @@ class MarginView { void DropGraphics() noexcept; void RefreshPixMaps(Surface *surfaceWindow, const ViewStyle &vsDraw); + void PaintOneMargin(Surface *surface, PRectangle rc, PRectangle rcMargin, const MarginStyle &marginStyle, + const EditModel &model, const ViewStyle &vs); void PaintMargin(Surface *surface, Sci::Line topLine, PRectangle rc, PRectangle rcMargin, const EditModel &model, const ViewStyle &vs); }; Modified: scintilla/src/PositionCache.cxx 98 lines changed, 72 insertions(+), 26 deletions(-) =================================================================== @@ -7,6 +7,7 @@ #include <cstddef> #include <cstdlib> +#include <cstdint> #include <cstring> #include <cmath> @@ -71,7 +72,6 @@ LineLayout::LineLayout(Sci::Line lineNumber_, int maxLineLength_) : containsCaret(false), edgeColumn(0), bracePreviousStyles{}, - hotspot(0,0), widthLine(wrapWidthInfinite), lines(1), wrapIndent(0) { @@ -377,6 +377,14 @@ constexpr size_t AlignUp(size_t value, size_t alignment) noexcept { constexpr size_t alignmentLLC = 20; +constexpr bool GraphicASCII(char ch) noexcept { + return ch >= ' ' && ch <= '~'; +} + +bool AllGraphicASCII(std::string_view text) noexcept { + return std::all_of(text.cbegin(), text.cend(), GraphicASCII); +} + } @@ -533,8 +541,10 @@ std::shared_ptr<LineLayout> LineLayoutCache::Retrieve(Sci::Line lineNumber, Sci: return std::make_shared<LineLayout>(lineNumber, maxChars); } +namespace { + // Simply pack the (maximum 4) character bytes into an int -static unsigned int KeyFromString(std::string_view charBytes) noexcept { +constexpr unsigned int KeyFromString(std::string_view charBytes) noexcept { PLATFORM_ASSERT(charBytes.length() <= 4); unsigned int k=0; for (size_t i=0; i < charBytes.length(); i++) { @@ -545,14 +555,21 @@ static unsigned int KeyFromString(std::string_view charBytes) noexcept { return k; } +constexpr unsigned int representationKeyCrLf = KeyFromString("\r\n"); + +} + void SpecialRepresentations::SetRepresentation(std::string_view charBytes, std::string_view value) { if ((charBytes.length() <= 4) && (value.length() <= Representation::maxLength)) { const unsigned int key = KeyFromString(charBytes); - MapRepresentation::iterator it = mapReprs.find(key); + const MapRepresentation::iterator it = mapReprs.find(key); if (it == mapReprs.end()) { // New entry so increment for first byte const unsigned char ucStart = charBytes.empty() ? 0 : charBytes[0]; startByteHasReprs[ucStart]++; + if (key == representationKeyCrLf) { + crlf = true; + } } mapReprs[key] = Representation(value); } @@ -561,7 +578,7 @@ void SpecialRepresentations::SetRepresentation(std::string_view charBytes, std:: void SpecialRepresentations::SetRepresentationAppearance(std::string_view charBytes, RepresentationAppearance appearance) { if (charBytes.length() <= 4) { const unsigned int key = KeyFromString(charBytes); - MapRepresentation::iterator it = mapReprs.find(key); + const MapRepresentation::iterator it = mapReprs.find(key); if (it == mapReprs.end()) { // Not present so fail return; @@ -573,7 +590,7 @@ void SpecialRepresentations::SetRepresentationAppearance(std::string_view charBy void SpecialRepresentations::SetRepresentationColour(std::string_view charBytes, ColourRGBA colour) { if (charBytes.length() <= 4) { const unsigned int key = KeyFromString(charBytes); - MapRepresentation::iterator it = mapReprs.find(key); + const MapRepresentation::iterator it = mapReprs.find(key); if (it == mapReprs.end()) { // Not present so fail return; @@ -585,24 +602,33 @@ void SpecialRepresentations::SetRepresentationColour(std::string_view charBytes, void SpecialRepresentations::ClearRepresentation(std::string_view charBytes) { if (charBytes.length() <= 4) { - MapRepresentation::iterator it = mapReprs.find(KeyFromString(charBytes)); + const unsigned int key = KeyFromString(charBytes); + const MapRepresentation::iterator it = mapReprs.find(key); if (it != mapReprs.end()) { mapReprs.erase(it); const unsigned char ucStart = charBytes.empty() ? 0 : charBytes[0]; startByteHasReprs[ucStart]--; + if (key == representationKeyCrLf) { + crlf = false; + } } } } +const Representation *SpecialRepresentations::GetRepresentation(std::string_view charBytes) const { + const MapRepresentation::const_iterator it = mapReprs.find(KeyFromString(charBytes)); + if (it != mapReprs.end()) { + return &(it->second); + } + return nullptr; +} + const Representation *SpecialRepresentations::RepresentationFromCharacter(std::string_view charBytes) const { if (charBytes.length() <= 4) { const unsigned char ucStart = charBytes.empty() ? 0 : charBytes[0]; if (!startByteHasReprs[ucStart]) return nullptr; - MapRepresentation::const_iterator it = mapReprs.find(KeyFromString(charBytes)); - if (it != mapReprs.end()) { - return &(it->second); - } + return GetRepresentation(charBytes); } return nullptr; } @@ -612,14 +638,15 @@ bool SpecialRepresentations::Contains(std::string_view charBytes) const { const unsigned char ucStart = charBytes.empty() ? 0 : charBytes[0]; if (!startByteHasReprs[ucStart]) return false; - MapRepresentation::const_iterator it = mapReprs.find(KeyFromString(charBytes)); + const MapRepresentation::const_iterator it = mapReprs.find(KeyFromString(charBytes)); return it != mapReprs.end(); } void SpecialRepresentations::Clear() { mapReprs.clear(); constexpr short none = 0; std::fill(startByteHasReprs, std::end(startByteHasReprs), none); + crlf = false; } void BreakFinder::Insert(Sci::Position val) { @@ -694,16 +721,23 @@ TextSegment BreakFinder::Next() { const int prev = nextBreak; while (nextBreak < lineRange.end) { int charWidth = 1; - if (encodingFamily == EncodingFamily::unicode) - charWidth = UTF8DrawBytes(reinterpret_cast<unsigned char *>(&ll->chars[nextBreak]), - static_cast<int>(lineRange.end - nextBreak)); - else if (encodingFamily == EncodingFamily::dbcs) - charWidth = pdoc->DBCSDrawBytes( - std::string_view(&ll->chars[nextBreak], lineRange.end - nextBreak)); - // Special case \r\n line ends if there is a representation - if (preprs->Contains("\r\n") && ll->chars[nextBreak] == '\r' && ll->chars[nextBreak + 1] == '\n') - charWidth = 2; - const Representation *repr = preprs->RepresentationFromCharacter(std::string_view(&ll->chars[nextBreak], charWidth)); + const char * const chars = &ll->chars[nextBreak]; + const unsigned char ch = chars[0]; + if (!UTF8IsAscii(ch) && encodingFamily != EncodingFamily::eightBit) { + if (encodingFamily == EncodingFamily::unicode) { + charWidth = UTF8DrawBytes(reinterpret_cast<const unsigned char *>(chars), static_cast<int>(lineRange.end - nextBreak)); + } else { + charWidth = pdoc->DBCSDrawBytes(std::string_view(chars, lineRange.end - nextBreak)); + } + } + const Representation *repr = nullptr; + if (preprs->MayContain(ch)) { + // Special case \r\n line ends if there is a representation + if (ch == '\r' && preprs->ContainsCrLf() && chars[1] == '\n') { + charWidth = 2; + } + repr = preprs->GetRepresentation(std::string_view(chars, charWidth)); + } if (((nextBreak > 0) && (ll->styles[nextBreak] != ll->styles[nextBreak - 1])) || repr || (nextBreak == saeNext)) { @@ -768,10 +802,10 @@ PositionCacheEntry::PositionCacheEntry(const PositionCacheEntry &other) : } void PositionCacheEntry::Set(unsigned int styleNumber_, std::string_view sv, - const XYPOSITION *positions_, unsigned int clock_) { + const XYPOSITION *positions_, uint16_t clock_) { Clear(); - styleNumber = styleNumber_; - len = static_cast<unsigned int>(sv.length()); + styleNumber = static_cast<uint16_t>(styleNumber_); + len = static_cast<uint16_t>(sv.length()); clock = clock_; if (sv.data() && positions_) { positions = std::make_unique<XYPOSITION[]>(len + (len / sizeof(XYPOSITION)) + 1); @@ -848,7 +882,17 @@ size_t PositionCache::GetSize() const noexcept { void PositionCache::MeasureWidths(Surface *surface, const ViewStyle &vstyle, unsigned int styleNumber, std::string_view sv, XYPOSITION *positions) { - allClear = false; + const Style &style = vstyle.styles[styleNumber]; + if (style.monospaceASCII) { + if (AllGraphicASCII(sv)) { + const XYPOSITION monospaceCharacterWidth = style.monospaceCharacterWidth; + for (size_t i = 0; i < sv.length(); i++) { + positions[i] = monospaceCharacterWidth * (i+1); + } + return; + } + } + size_t probe = pces.size(); // Out of bounds if ((!pces.empty()) && (sv.length() < 30)) { // Only store short strings in the cache so it doesn't churn with @@ -869,7 +913,8 @@ void PositionCache::MeasureWidths(Surface *surface, const ViewStyle &vstyle, uns probe = probe2; } } - const Font *fontStyle = vstyle.styles[styleNumber].font.get(); + + const Font *fontStyle = style.font.get(); surface->MeasureWidths(fontStyle, sv, positions); if (probe < pces.size()) { // Store into cache @@ -882,6 +927,7 @@ void PositionCache::MeasureWidths(Surface *surface, const ViewStyle &vstyle, uns } clock = 2; } + allClear = false; pces[probe].Set(styleNumber, sv, positions, clock); } } Modified: scintilla/src/PositionCache.h 21 lines changed, 13 insertions(+), 8 deletions(-) =================================================================== @@ -79,9 +79,6 @@ class LineLayout { std::unique_ptr<BidiData> bidiData; - // Hotspot support - Range hotspot; - // Wrapped line support int widthLine; int lines; @@ -175,9 +172,9 @@ class LineLayoutCache { }; class PositionCacheEntry { - unsigned int styleNumber:8; - unsigned int len:8; - unsigned int clock:16; + uint16_t styleNumber; + uint16_t len; + uint16_t clock; std::unique_ptr<XYPOSITION []> positions; public: PositionCacheEntry() noexcept; @@ -188,7 +185,7 @@ class PositionCacheEntry { void operator=(const PositionCacheEntry &) = delete; void operator=(PositionCacheEntry &&) = delete; ~PositionCacheEntry(); - void Set(unsigned int styleNumber_, std::string_view sv, const XYPOSITION *positions_, unsigned int clock_); + void Set(unsigned int styleNumber_, std::string_view sv, const XYPOSITION *positions_, uint16_t clock_); void Clear() noexcept; bool Retrieve(unsigned int styleNumber_, std::string_view sv, XYPOSITION *positions_) const noexcept; static size_t Hash(unsigned int styleNumber_, std::string_view sv) noexcept; @@ -212,13 +209,21 @@ typedef std::map<unsigned int, Representation> MapRepresentation; class SpecialRepresentations { MapRepresentation mapReprs; short startByteHasReprs[0x100] {}; + bool crlf = false; public: void SetRepresentation(std::string_view charBytes, std::string_view value); void SetRepresentationAppearance(std::string_view charBytes, RepresentationAppearance appearance); void SetRepresentationColour(std::string_view charBytes, ColourRGBA colour); void ClearRepresentation(std::string_view charBytes); + const Representation *GetRepresentation(std::string_view charBytes) const; const Representation *RepresentationFromCharacter(std::string_view charBytes) const; bool Contains(std::string_view charBytes) const; + bool ContainsCrLf() const noexcept { + return crlf; + } + bool MayContain(unsigned char ch) const noexcept { + return startByteHasReprs[ch] != 0; + } void Clear(); }; @@ -268,7 +273,7 @@ class BreakFinder { class PositionCache { std::vector<PositionCacheEntry> pces; - unsigned int clock; + uint16_t clock; bool allClear; public: PositionCache(); Modified: scintilla/src/RESearch.cxx 4 lines changed, 0 insertions(+), 4 deletions(-) =================================================================== @@ -260,10 +260,6 @@ RESearch::RESearch(CharClassify *charClassTable) { Clear(); } -RESearch::~RESearch() { - Clear(); -} - void RESearch::Clear() noexcept { for (int i = 0; i < MAXTAG; i++) { pat[i].clear(); Modified: scintilla/src/RESearch.h 1 lines changed, 0 insertions(+), 1 deletions(-) =================================================================== @@ -23,7 +23,6 @@ class RESearch { public: explicit RESearch(CharClassify *charClassTable); // No dynamic allocation so default copy constructor and assignment operator are OK. - ~RESearch(); void Clear() noexcept; void GrabMatches(const CharacterIndexer &ci); const char *Compile(const char *pattern, Sci::Position length, bool caseSensitive, bool posix) noexcept; Modified: scintilla/src/ScintillaBase.cxx 34 lines changed, 3 insertions(+), 31 deletions(-) =================================================================== @@ -7,6 +7,7 @@ #include <cstddef> #include <cstdlib> +#include <cstdint> #include <cassert> #include <cstring> @@ -550,13 +551,8 @@ namespace Scintilla::Internal { class LexState : public LexInterface { public: explicit LexState(Document *pdoc_) noexcept; - void SetInstance(ILexer5 *instance_); - // Deleted so LexState objects can not be copied. - LexState(const LexState &) = delete; - LexState(LexState &&) = delete; - LexState &operator=(const LexState &) = delete; - LexState &operator=(LexState &&) = delete; - ~LexState() override; + + // LexInterface deleted the standard operators and defined the virtual destructor so don't need to here. const char *DescribeWordListSets(); void SetWordList(int n, const char *wl); @@ -592,30 +588,6 @@ class LexState : public LexInterface { LexState::LexState(Document *pdoc_) noexcept : LexInterface(pdoc_) { } -LexState::~LexState() { - if (instance) { - try { - instance->Release(); - } catch (...) { - // ILexer5::Release must not throw, ignore if it does. - } - instance = nullptr; - } -} - -void LexState::SetInstance(ILexer5 *instance_) { - if (instance) { - try { - instance->Release(); - } catch (...) { - // ILexer5::Release must not throw, ignore if it does. - } - instance = nullptr; - } - instance = instance_; - pdoc->LexerChanged(); -} - LexState *ScintillaBase::DocumentLexState() { if (!pdoc->GetLexInterface()) { pdoc->SetLexInterface(std::make_unique<LexState>(pdoc)); Modified: scintilla/src/Selection.cxx 3 lines changed, 0 insertions(+), 3 deletions(-) =================================================================== @@ -194,9 +194,6 @@ Selection::Selection() : mainRange(0), moveExtends(false), tentativeMai@@ Diff output truncated at 100000 characters. @@ -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
[geany/geany-osx] f32f2e: Add gnutls dependency for VTE to disable warning in console
by Jiří Techet
14 Nov '21
14 Nov '21
Branch: refs/heads/master Author: Jiří Techet <techet(a)gmail.com> Committer: Jiří Techet <techet(a)gmail.com> Date: Sat, 13 Nov 2021 23:39:31 UTC Commit: f32f2e19e02a68dac1dea0d15bd3336dfdb7298b
https://github.com/geany/geany-osx/commit/f32f2e19e02a68dac1dea0d15bd3336df…
Log Message: ----------- Add gnutls dependency for VTE to disable warning in console Modified Paths: -------------- geany.modules Modified: geany.modules 3 lines changed, 2 insertions(+), 1 deletions(-) =================================================================== @@ -35,7 +35,7 @@ version="10.39"/> </autotools> - <meson id="vte291" mesonargs="-Dgnutls=false -Dicu=false -Dvapi=false -D_b_symbolic_functions=false"> + <meson id="vte291" mesonargs="-Dicu=false -Dvapi=false -D_b_symbolic_functions=false"> <branch repo="
download.gitlab.gnome.org
" module="vte/-/archive/${version}/vte-${version}.tar.bz2" version="0.66.1"> @@ -44,6 +44,7 @@ </branch> <dependencies> <dep package="pcre2" /> + <dep package="gnutls" /> </dependencies> </meson> -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
[geany/geany-osx] 92eda5: Add explicit hunspell depencency for spellcheck plugin
by Jiří Techet
14 Nov '21
14 Nov '21
Branch: refs/heads/master Author: Jiří Techet <techet(a)gmail.com> Committer: Jiří Techet <techet(a)gmail.com> Date: Sat, 13 Nov 2021 23:39:01 UTC Commit: 92eda5737da2f2ba5104d9b0967fa1dce4ceea6d
https://github.com/geany/geany-osx/commit/92eda5737da2f2ba5104d9b0967fa1dce…
Log Message: ----------- Add explicit hunspell depencency for spellcheck plugin Modified Paths: -------------- geany.modules Modified: geany.modules 1 lines changed, 1 insertions(+), 0 deletions(-) =================================================================== @@ -128,6 +128,7 @@ <dependencies> <dep package="vala" /> <dep package="libgit2" /> + <dep package="hunspell" /> <dep package="enchant" /> </dependencies> </metamodule> -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
← Newer
1
2
3
4
5
6
7
Older →
Jump to page:
1
2
3
4
5
6
7
Results per page:
10
25
50
100
200