Skip to content

Commit

Permalink
Changes to work with pragtical luajit
Browse files Browse the repository at this point in the history
  • Loading branch information
jgmdev committed May 13, 2024
1 parent 13d96aa commit d4c7491
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 9 deletions.
31 changes: 25 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
name: CI
on: { push: { branches: [master] } }
env:
PPM_PLUGINS: https://raw.githubusercontent.com/adamharrison/lite-xl-maintenance/latest/lpm-plugins/gh.lua
permissions: write-all

jobs:
version:
runs-on: ubuntu-latest
Expand All @@ -16,8 +15,16 @@ jobs:
id: setup_release
env: { GITHUB_TOKEN: "${{ github.token }}" }
run: |
wget https://github.com/pragtical/plugin-manager/releases/download/latest/ppm.x86_64-linux -O ppm-latest && chmod +x ppm-latest
echo "version=`./ppm-latest gh version`" >> $GITHUB_OUTPUT
export VERSION=`git describe --tags --match "v*" | tail -c +2`
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Building terminal version $VERSION."
perl -pe 'last if $_ =~ m/^\s*#/ && $_ !~ m/#\s*$ENV{VERSION}/' < CHANGELOG.md | tail -n +2 > NOTES.md
if [[ `git tag --points-at HEAD | head -c 1` == "v" ]]; then
gh release delete -y v$VERSION || true; gh release create -t v$VERSION v$VERSION
gh release delete -y latest || true; gh release create -t latest latest
fi
gh release delete -y continuous || true; gh release create -p -t 'Continuous Release' continuous -F NOTES.md
build_linux:
needs: [version]
permissions: write-all
Expand All @@ -27,6 +34,9 @@ jobs:
- name: Checkout Code
uses: actions/checkout@v3
with: { fetch-depth: 0, submodules: true }
- name: Install Cross Compiler
run: |
sudo apt-get install -y gcc-aarch64-linux-gnu
- name: Build Linux
run: |
BIN=libterminal.x86_64-linux.so ./build.sh -O3 -DLIBTERMINAL_VERSION='"'${{ needs.version.outputs.version }}-x86_64-linux'"'
Expand Down Expand Up @@ -86,5 +96,14 @@ jobs:
env:
GITHUB_TOKEN: "${{ github.token }}"
run: |
wget https://github.com/pragtical/plugin-manager/releases/download/latest/ppm.x86_64-linux -O ppm-latest && chmod +x ppm-latest
./ppm-latest gh release Linux/*.so MacOS/*.so Windows/*.dll
if [[ `git tag --points-at HEAD | head -c 1` == "v" ]]; then
gh release upload v${{ needs.version.outputs.version }} Linux/*.so MacOS/*.so Windows/*.dll
gh release upload latest Linux/*.so MacOS/*.so Windows/*.dll
git branch -f latest HEAD
git tag -f latest
git push -f origin refs/heads/latest
git push -f origin refs/tags/latest
fi
gh release upload continuous Linux/*.so MacOS/*.so Windows/*.dll
git tag -f continuous
git push -f origin refs/tags/continuous
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
`pragtical-terminal` is a (mostly) fully-featured terminal emulator designed to
slot into pragtical as a plugin for windows (Windows 10+ only), mac and linux.

![image](https://github.com/adamharrison/lite-xl-terminal/assets/1034518/6b8003da-d4c1-4227-8fc9-3d2b1ae89bf2)
![image](screenshots/preview.png)

## Description

Expand Down
31 changes: 29 additions & 2 deletions plugins/terminal/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,14 @@ config.plugins.terminal = common.merge({
antialiasing = "subpixel",
hinting = "slight"
}
}
},
on_apply = function()
if not config.plugins.terminal.bold_font then
config.plugins.terminal.bold_font = config.plugins.terminal.font:copy(
config.plugins.terminal.font:get_size(), { smoothing = true }
)
end
end
},
{
label = "Bold Text in Bright Colors",
Expand All @@ -183,7 +190,14 @@ config.plugins.terminal = common.merge({
}
}
}, config.plugins.terminal)
if not config.plugins.terminal.bold_font then config.plugins.terminal.bold_font = config.plugins.terminal.font:copy(style.code_font:get_size(), { smoothing = true }) end

core.add_thread(function()
if not config.plugins.terminal.bold_font then
config.plugins.terminal.bold_font = config.plugins.terminal.font:copy(
config.plugins.terminal.font:get_size(), { smoothing = true }
)
end
end)

-- contrast functions pulled from https://github.com/xtermjs/xterm.js/blob/99df13b085aecb051f1373c5b7f8e819c4f41442/src/common/Color.ts#L285.
local function contrastRatio(l1, l2)
Expand Down Expand Up @@ -276,6 +290,17 @@ function TerminalView:new(options)
self.modified_since_last_focus = false
end

function TerminalView:on_scale_change(new_scale, prev_scale)
if self.options.font ~= style.code_font then
self.options.font:set_size(
self.options.font:get_size() * (new_scale / prev_scale)
)
end
self.options.bold_font:set_size(
self.options.bold_font:get_size() * (new_scale / prev_scale)
)
end

function TerminalView:shift_selection_update()
local shifts = self.terminal:update()
if shifts and not self.focused then self.modified_since_last_focus = true end
Expand Down Expand Up @@ -305,6 +330,7 @@ end


function TerminalView:update()
TerminalView.super.update(self)
if self.size.x > 0 and self.size.y > 0 and not self.terminal or self.last_size.x ~= self.size.x or self.last_size.y ~= self.size.y then
self.columns = math.max(math.floor((self.size.x - self.options.padding.x*2) / self.options.font:get_width("W")), 1)
self.lines = math.max(math.floor((self.size.y - self.options.padding.y*2) / self.options.font:get_height()), 1)
Expand Down Expand Up @@ -429,6 +455,7 @@ function TerminalView:draw()
local offset = 0
local foreground, background, text_style
for i = 1, #line, 2 do
line[i] = math.tointeger(line[i])
background = self:convert_color(bit.band(line[i], 0xFFFFFFFF), "background")
foreground, text_style = self:convert_color(bit.rshift(line[i], 32), "foreground", self.options.bold_text_in_bright_colors)

Expand Down
Binary file added screenshots/preview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit d4c7491

Please sign in to comment.