Skip to content

Commit d4c7491

Browse files
committed
Changes to work with pragtical luajit
1 parent 13d96aa commit d4c7491

File tree

4 files changed

+55
-9
lines changed

4 files changed

+55
-9
lines changed

.github/workflows/build.yml

+25-6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
name: CI
22
on: { push: { branches: [master] } }
3-
env:
4-
PPM_PLUGINS: https://raw.githubusercontent.com/adamharrison/lite-xl-maintenance/latest/lpm-plugins/gh.lua
53
permissions: write-all
4+
65
jobs:
76
version:
87
runs-on: ubuntu-latest
@@ -16,8 +15,16 @@ jobs:
1615
id: setup_release
1716
env: { GITHUB_TOKEN: "${{ github.token }}" }
1817
run: |
19-
wget https://github.com/pragtical/plugin-manager/releases/download/latest/ppm.x86_64-linux -O ppm-latest && chmod +x ppm-latest
20-
echo "version=`./ppm-latest gh version`" >> $GITHUB_OUTPUT
18+
export VERSION=`git describe --tags --match "v*" | tail -c +2`
19+
echo "version=$VERSION" >> $GITHUB_OUTPUT
20+
echo "Building terminal version $VERSION."
21+
perl -pe 'last if $_ =~ m/^\s*#/ && $_ !~ m/#\s*$ENV{VERSION}/' < CHANGELOG.md | tail -n +2 > NOTES.md
22+
if [[ `git tag --points-at HEAD | head -c 1` == "v" ]]; then
23+
gh release delete -y v$VERSION || true; gh release create -t v$VERSION v$VERSION
24+
gh release delete -y latest || true; gh release create -t latest latest
25+
fi
26+
gh release delete -y continuous || true; gh release create -p -t 'Continuous Release' continuous -F NOTES.md
27+
2128
build_linux:
2229
needs: [version]
2330
permissions: write-all
@@ -27,6 +34,9 @@ jobs:
2734
- name: Checkout Code
2835
uses: actions/checkout@v3
2936
with: { fetch-depth: 0, submodules: true }
37+
- name: Install Cross Compiler
38+
run: |
39+
sudo apt-get install -y gcc-aarch64-linux-gnu
3040
- name: Build Linux
3141
run: |
3242
BIN=libterminal.x86_64-linux.so ./build.sh -O3 -DLIBTERMINAL_VERSION='"'${{ needs.version.outputs.version }}-x86_64-linux'"'
@@ -86,5 +96,14 @@ jobs:
8696
env:
8797
GITHUB_TOKEN: "${{ github.token }}"
8898
run: |
89-
wget https://github.com/pragtical/plugin-manager/releases/download/latest/ppm.x86_64-linux -O ppm-latest && chmod +x ppm-latest
90-
./ppm-latest gh release Linux/*.so MacOS/*.so Windows/*.dll
99+
if [[ `git tag --points-at HEAD | head -c 1` == "v" ]]; then
100+
gh release upload v${{ needs.version.outputs.version }} Linux/*.so MacOS/*.so Windows/*.dll
101+
gh release upload latest Linux/*.so MacOS/*.so Windows/*.dll
102+
git branch -f latest HEAD
103+
git tag -f latest
104+
git push -f origin refs/heads/latest
105+
git push -f origin refs/tags/latest
106+
fi
107+
gh release upload continuous Linux/*.so MacOS/*.so Windows/*.dll
108+
git tag -f continuous
109+
git push -f origin refs/tags/continuous

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
`pragtical-terminal` is a (mostly) fully-featured terminal emulator designed to
44
slot into pragtical as a plugin for windows (Windows 10+ only), mac and linux.
55

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

88
## Description
99

plugins/terminal/init.lua

+29-2
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,14 @@ config.plugins.terminal = common.merge({
165165
antialiasing = "subpixel",
166166
hinting = "slight"
167167
}
168-
}
168+
},
169+
on_apply = function()
170+
if not config.plugins.terminal.bold_font then
171+
config.plugins.terminal.bold_font = config.plugins.terminal.font:copy(
172+
config.plugins.terminal.font:get_size(), { smoothing = true }
173+
)
174+
end
175+
end
169176
},
170177
{
171178
label = "Bold Text in Bright Colors",
@@ -183,7 +190,14 @@ config.plugins.terminal = common.merge({
183190
}
184191
}
185192
}, config.plugins.terminal)
186-
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
193+
194+
core.add_thread(function()
195+
if not config.plugins.terminal.bold_font then
196+
config.plugins.terminal.bold_font = config.plugins.terminal.font:copy(
197+
config.plugins.terminal.font:get_size(), { smoothing = true }
198+
)
199+
end
200+
end)
187201

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

293+
function TerminalView:on_scale_change(new_scale, prev_scale)
294+
if self.options.font ~= style.code_font then
295+
self.options.font:set_size(
296+
self.options.font:get_size() * (new_scale / prev_scale)
297+
)
298+
end
299+
self.options.bold_font:set_size(
300+
self.options.bold_font:get_size() * (new_scale / prev_scale)
301+
)
302+
end
303+
279304
function TerminalView:shift_selection_update()
280305
local shifts = self.terminal:update()
281306
if shifts and not self.focused then self.modified_since_last_focus = true end
@@ -305,6 +330,7 @@ end
305330

306331

307332
function TerminalView:update()
333+
TerminalView.super.update(self)
308334
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
309335
self.columns = math.max(math.floor((self.size.x - self.options.padding.x*2) / self.options.font:get_width("W")), 1)
310336
self.lines = math.max(math.floor((self.size.y - self.options.padding.y*2) / self.options.font:get_height()), 1)
@@ -429,6 +455,7 @@ function TerminalView:draw()
429455
local offset = 0
430456
local foreground, background, text_style
431457
for i = 1, #line, 2 do
458+
line[i] = math.tointeger(line[i])
432459
background = self:convert_color(bit.band(line[i], 0xFFFFFFFF), "background")
433460
foreground, text_style = self:convert_color(bit.rshift(line[i], 32), "foreground", self.options.bold_text_in_bright_colors)
434461

screenshots/preview.png

164 KB
Loading

0 commit comments

Comments
 (0)