Fix word selection match not being visible with word wrap.

Try to improve ecode nightly yml.
This commit is contained in:
Martín Lucas Golini
2024-10-01 20:30:30 -03:00
parent d668f4f5c5
commit 38349805d3
8 changed files with 123 additions and 28 deletions

View File

@@ -43,7 +43,7 @@ jobs:
Builds that include most recent changes as they happen. For stable releases check the whole list of [releases](https://github.com/SpartanJ/ecode/releases).
build_linux:
name: Linux
name: Linux Nightly
needs: release
strategy:
matrix:
@@ -93,9 +93,8 @@ jobs:
fi
- name: Install dependencies
run: |
sudo apt-get install -y ccache premake4 libfuse2 fuse
sudo apt-get install -y premake4 libfuse2 fuse
if [[ $(uname -m) = "x86_64" ]]; then
sudo apt-get install -y mingw-w64
wget https://github.com/premake/premake-core/releases/download/v5.0.0-beta2/premake-5.0.0-beta2-linux.tar.gz
tar xvzf premake-5.0.0-beta2-linux.tar.gz
fi
@@ -112,15 +111,13 @@ jobs:
else
sudo apt-get install -y libsdl2-dev:arm64 libsdl2-2.0-0:arm64
fi
bash projects/linux/scripts/install_sdl2.sh
- name: Install Cross Compiler
if: ${{ matrix.config.compiler != 'default' }}
run: sudo apt-get install -y ${{ matrix.config.compiler }}
- name: Build ecode
run: |
bash projects/linux/ecode/build.app.sh --version ${{ env.INSTALL_REF }} --arch ${{ matrix.config.arch }}
if [[ $(uname -m) = "x86_64" ]]; then
bash projects/mingw32/ecode/build.app.sh --version ${{ env.INSTALL_REF }}
fi
- name: Upload Files
uses: softprops/action-gh-release@v2
with:
@@ -130,10 +127,61 @@ jobs:
files: |
projects/linux/ecode/ecode-linux-${{ env.INSTALL_REF }}-${{ env.RARCH }}.AppImage
projects/linux/ecode/ecode-linux-${{ env.INSTALL_REF }}-${{ env.RARCH }}.tar.gz
build_windows_cross:
name: Windows x86_64 Nightly
needs: release
strategy:
matrix:
config:
- compiler: default
arch: x86_64
container: ubuntu-22.04
runs-on: ${{ matrix.config.container }}
env:
CC: gcc
CXX: g++
steps:
- name: Checkout Code
uses: actions/checkout@v4
with: { fetch-depth: 0, submodules: 'recursive' }
- name: Set Environment Variables
run: |
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
echo "INSTALL_REF=${{ needs.release.outputs.version }}" >> "$GITHUB_ENV"
echo "RARCH=$(uname -m)" >> "$GITHUB_ENV"
- name: Update Packages
run: |
sudo add-apt-repository -y universe
sudo add-apt-repository -y multiverse
sudo apt-get update
- name: Install dependencies
run: |
sudo apt-get install -y premake4 libfuse2 fuse mingw-w64 gcc-12 g++-12
wget https://github.com/premake/premake-core/releases/download/v5.0.0-beta2/premake-5.0.0-beta2-linux.tar.gz
tar xvzf premake-5.0.0-beta2-linux.tar.gz
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 10
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-12 10
sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 30
sudo update-alternatives --set cc /usr/bin/gcc
sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 30
sudo update-alternatives --set c++ /usr/bin/g++
sudo update-alternatives --config gcc
sudo update-alternatives --config g++
- name: Build ecode
run: |
bash projects/mingw32/ecode/build.app.sh --version ${{ env.INSTALL_REF }}
- name: Upload Files
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ needs.release.outputs.version }}
draft: false
prerelease: true
files: |
projects/mingw32/ecode/ecode-windows-${{ env.INSTALL_REF }}-${{ env.RARCH }}.zip
build_macos:
name: macOS
name: macOS arm64 Nightly
needs: release
runs-on: macos-14
strategy:
@@ -160,8 +208,8 @@ jobs:
- name: Install Dependencies
run: |
brew install bash sdl2 create-dmg premake p7zip
curl -OL https://github.com/libsdl-org/SDL/releases/download/release-2.30.7/SDL2-2.30.7.dmg
7z x SDL2-2.30.7.dmg
curl -OL https://github.com/libsdl-org/SDL/releases/download/release-2.30.8/SDL2-2.30.8.dmg
7z x SDL2-2.30.8.dmg
cp -r ./SDL2/SDL2.framework src/thirdparty/
- name: Build
run: |
@@ -179,7 +227,7 @@ jobs:
projects/macos/ecode/ecode-macos-${{ env.INSTALL_REF }}-arm64.dmg
build_macos_cross:
name: macOS_cross_build
name: macOS x86_64 Nightly
needs: release
runs-on: macos-14
strategy:
@@ -206,8 +254,8 @@ jobs:
- name: Install Dependencies
run: |
brew install bash sdl2 create-dmg premake p7zip
curl -OL https://github.com/libsdl-org/SDL/releases/download/release-2.30.7/SDL2-2.30.7.dmg
hdiutil attach SDL2-2.30.7.dmg
curl -OL https://github.com/libsdl-org/SDL/releases/download/release-2.30.8/SDL2-2.30.8.dmg
hdiutil attach SDL2-2.30.8.dmg
sudo cp -r /Volumes/SDL2/SDL2.framework /Library/Frameworks/
hdiutil detach /Volumes/SDL2
- name: Build

View File

@@ -32,7 +32,7 @@ jobs:
tar xvzf premake-5.0.0-beta2-linux.tar.gz
- name: Build
run: |
./premake5 --with-text-shaper gmake2
./premake5 --with-text-shaper --disable-static-build gmake2
cd make/linux
make all -j$(nproc) -e config=release_x86_64
- name: Unit Tests

View File

@@ -19,7 +19,7 @@ jobs:
brew install wget SDL2 premake
- name: Build
run: |
premake5 --with-text-shaper gmake2
premake5 --with-text-shaper --disable-static-build gmake2
make -C make/macosx/ -e config=release_arm64
- name: Unit Tests
run: |

View File

@@ -28,7 +28,7 @@ jobs:
- name: Create project
shell: powershell
run: |
./premake5.exe --windows-vc-build --with-text-shaper vs2022
./premake5.exe --windows-vc-build --with-text-shaper --disable-static-build vs2022
- name: Build
shell: cmd
run: |

View File

@@ -507,11 +507,13 @@ class EE_API UICodeEditor : public UIWidget, public TextDocument::Client {
virtual Int64 getColFromXOffset( VisibleIndex visibleIndex, const Float& x ) const;
std::vector<Rectf> getTextRangeRectangles(
const TextRange& range, const Vector2f& startScroll,
std::optional<const DocumentLineRange> lineRange = {}, std::optional<Float> lineHeight = {},
std::optional<DocumentViewLineRange> visibleLineRange =
{} /* if passed it will clip rectangles against the visual line range */ );
std::vector<Rectf>
getTextRangeRectangles( const TextRange& range, const Vector2f& startScroll,
std::optional<const DocumentLineRange> lineRange = {},
std::optional<Float> lineHeight = {},
/* if passed it will clip rectangles against the visual line range */
std::optional<DocumentViewLineRange> visibleLineRange =
std::optional<DocumentViewLineRange>() );
virtual Float getLineWidth( const Int64& docLine );
@@ -968,7 +970,8 @@ class EE_API UICodeEditor : public UIWidget, public TextDocument::Client {
const DocumentViewLineRange& visibleLineRange );
virtual void drawSelectionMatch( const DocumentLineRange& lineRange,
const Vector2f& startScroll, const Float& lineHeight );
const Vector2f& startScroll, const Float& lineHeight,
const DocumentViewLineRange& visibleLineRange );
virtual void drawWordMatch( const String& text, const DocumentLineRange& lineRange,
const Vector2f& startScroll, const Float& lineHeight,

View File

@@ -142,10 +142,10 @@ os_links = { }
backends = { }
static_backends = { }
backend_selected = false
remote_sdl2_version = "SDL2-2.30.3"
remote_sdl2_devel_src_url = "https://libsdl.org/release/SDL2-2.30.3.zip"
remote_sdl2_devel_vc_url = "https://www.libsdl.org/release/SDL2-devel-2.30.3-VC.zip"
remote_sdl2_devel_mingw_url = "https://www.libsdl.org/release/SDL2-devel-2.30.3-mingw.zip"
remote_sdl2_version = "SDL2-2.30.8"
remote_sdl2_devel_src_url = "https://libsdl.org/release/SDL2-2.30.8.zip"
remote_sdl2_devel_vc_url = "https://www.libsdl.org/release/SDL2-devel-2.30.8-VC.zip"
remote_sdl2_devel_mingw_url = "https://www.libsdl.org/release/SDL2-devel-2.30.8-mingw.zip"
function incdirs( dirs )
if is_xcode() then

View File

@@ -0,0 +1,43 @@
#!/bin/bash
# Define SDL version and download URL
SDL_VERSION="2.30.8"
SDL_URL="https://libsdl.org/release/SDL2-${SDL_VERSION}.zip"
# Install necessary dependencies
sudo apt-get update
sudo apt-get install -y build-essential unzip wget libasound2-dev libpulse-dev libudev-dev libx11-dev libxext-dev libxrandr-dev libxcursor-dev libxi-dev libxinerama-dev libxss-dev libxkbcommon-dev
# Create a temporary directory for the SDL2 build
mkdir -p ./sdl2_build
cd ./sdl2_build || exit
# Download SDL2 source code
echo "Downloading SDL2 version ${SDL_VERSION}..."
wget "${SDL_URL}" -O SDL2.zip || exit
# Unzip the SDL2 source code
echo "Extracting SDL2..."
unzip SDL2.zip || exit
# Enter the SDL2 directory
cd "SDL2-${SDL_VERSION}" || exit
# Configure, build, and install SDL2
echo "Configuring SDL2..."
./configure || exit
echo "Building SDL2..."
make -j"$(nproc)" || exit
echo "Installing SDL2..."
sudo make install || exit
# Clean up
echo "Cleaning up..."
rm -rf ./sdl2_build
# Update shared library cache
sudo ldconfig
echo "SDL2 version ${SDL_VERSION} installed successfully!"

View File

@@ -302,7 +302,7 @@ void UICodeEditor::draw() {
}
if ( mHighlightSelectionMatch && mDoc->hasSelection() && mDoc->getSelection().inSameLine() ) {
drawSelectionMatch( lineRange, startScroll, lineHeight );
drawSelectionMatch( lineRange, startScroll, lineHeight, visibleLineRange );
}
if ( mDoc->hasSelection() ) {
@@ -3384,7 +3384,8 @@ void UICodeEditor::drawMatchingBrackets( const Vector2f& startScroll, const Floa
}
void UICodeEditor::drawSelectionMatch( const DocumentLineRange& lineRange,
const Vector2f& startScroll, const Float& lineHeight ) {
const Vector2f& startScroll, const Float& lineHeight,
const DocumentViewLineRange& visibleLineRange ) {
static const String notSpaceStr = "\t ";
if ( !mDoc->hasSelection() )
return;
@@ -3396,7 +3397,7 @@ void UICodeEditor::drawSelectionMatch( const DocumentLineRange& lineRange,
String text( selectionLine.substr(
selection.start().column(), selection.end().column() - selection.start().column() ) );
if ( !text.empty() && text.find_first_not_of( notSpaceStr.view() ) != String::InvalidPos )
drawWordMatch( text, lineRange, startScroll, lineHeight, true );
drawWordMatch( text, lineRange, startScroll, lineHeight, true, visibleLineRange );
}
}