mirror of https://github.com/Hilbis/Hilbish
Compare commits
No commits in common. "ff6e08902f70ecd234c96f08089fd03464645272" and "d46c079afbaae33d0e28bf3813549aafc38e7b88" have entirely different histories.
ff6e08902f
...
d46c079afb
|
@ -1,12 +1,8 @@
|
||||||
name: Build
|
name: Build
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
- push
|
||||||
branches:
|
- pull_request
|
||||||
- master
|
|
||||||
pull_request:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
@ -23,18 +19,18 @@ jobs:
|
||||||
goos: windows
|
goos: windows
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
submodules: true
|
submodules: true
|
||||||
- name: Setup Go
|
- name: Setup Go
|
||||||
uses: actions/setup-go@v5
|
uses: actions/setup-go@v2
|
||||||
with:
|
with:
|
||||||
go-version: '1.18.8'
|
go-version: '1.18.8'
|
||||||
- name: Download Task
|
- name: Download Task
|
||||||
run: 'sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d'
|
run: 'sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d'
|
||||||
- name: Build
|
- name: Build
|
||||||
run: GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} ./bin/task
|
run: GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} ./bin/task
|
||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v2
|
||||||
if: matrix.goos == 'windows'
|
if: matrix.goos == 'windows'
|
||||||
with:
|
with:
|
||||||
name: hilbish-${{ matrix.goos }}-${{ matrix.goarch }}
|
name: hilbish-${{ matrix.goos }}-${{ matrix.goarch }}
|
||||||
|
@ -48,7 +44,7 @@ jobs:
|
||||||
libs
|
libs
|
||||||
docs
|
docs
|
||||||
emmyLuaDocs
|
emmyLuaDocs
|
||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v2
|
||||||
if: matrix.goos != 'windows'
|
if: matrix.goos != 'windows'
|
||||||
with:
|
with:
|
||||||
name: hilbish-${{ matrix.goos }}-${{ matrix.goarch }}
|
name: hilbish-${{ matrix.goos }}-${{ matrix.goarch }}
|
||||||
|
|
|
@ -26,7 +26,7 @@ jobs:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
# Initializes the CodeQL tools for scanning.
|
# Initializes the CodeQL tools for scanning.
|
||||||
- name: Initialize CodeQL
|
- name: Initialize CodeQL
|
||||||
|
|
|
@ -9,8 +9,8 @@ jobs:
|
||||||
gen:
|
gen:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/setup-go@v5
|
- uses: actions/setup-go@v2
|
||||||
- name: Run docgen
|
- name: Run docgen
|
||||||
run: go run cmd/docgen/docgen.go
|
run: go run cmd/docgen/docgen.go
|
||||||
- name: Commit new docs
|
- name: Commit new docs
|
||||||
|
|
|
@ -9,7 +9,7 @@ jobs:
|
||||||
create-release:
|
create-release:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v2
|
||||||
- uses: taiki-e/create-gh-release-action@v1
|
- uses: taiki-e/create-gh-release-action@v1
|
||||||
with:
|
with:
|
||||||
title: Hilbish $tag
|
title: Hilbish $tag
|
||||||
|
@ -30,7 +30,7 @@ jobs:
|
||||||
- goarch: arm64
|
- goarch: arm64
|
||||||
goos: windows
|
goos: windows
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
submodules: true
|
submodules: true
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
|
@ -1,26 +1,22 @@
|
||||||
name: Build website
|
name: Build website
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
- push
|
||||||
branches:
|
- pull_request
|
||||||
- master
|
|
||||||
pull_request:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
deploy:
|
deploy:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
submodules: true
|
submodules: true
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Setup Hugo
|
- name: Setup Hugo
|
||||||
uses: peaceiris/actions-hugo@v3
|
uses: peaceiris/actions-hugo@v2
|
||||||
with:
|
with:
|
||||||
hugo-version: '0.111.3'
|
hugo-version: 'latest'
|
||||||
extended: true
|
extended: true
|
||||||
|
|
||||||
- name: Set branch name
|
- name: Set branch name
|
||||||
|
@ -36,14 +32,14 @@ jobs:
|
||||||
|
|
||||||
- name: Deploy
|
- name: Deploy
|
||||||
if: env.BRANCH_NAME == 'master' && github.repository_owner == 'Rosettea'
|
if: env.BRANCH_NAME == 'master' && github.repository_owner == 'Rosettea'
|
||||||
uses: peaceiris/actions-gh-pages@v4
|
uses: peaceiris/actions-gh-pages@v3
|
||||||
with:
|
with:
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
publish_dir: ./website/public
|
publish_dir: ./website/public
|
||||||
keep_files: true
|
keep_files: true
|
||||||
- name: Deploy
|
- name: Deploy
|
||||||
if: env.BRANCH_NAME != 'master' && github.repository_owner == 'Rosettea'
|
if: env.BRANCH_NAME != 'master' && github.repository_owner == 'Rosettea'
|
||||||
uses: peaceiris/actions-gh-pages@v4
|
uses: peaceiris/actions-gh-pages@v3
|
||||||
with:
|
with:
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
publish_dir: ./website/public
|
publish_dir: ./website/public
|
||||||
|
|
|
@ -28,9 +28,6 @@ hilbish.run('wc -l', {
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
### Fixed
|
|
||||||
- Fix ansi attributes causing issues with text when cut off in greenhouse
|
|
||||||
|
|
||||||
## [2.2.3] - 2024-04-27
|
## [2.2.3] - 2024-04-27
|
||||||
### Fixed
|
### Fixed
|
||||||
- Highligher and hinter work now, since it was regressed from the previous minor release.
|
- Highligher and hinter work now, since it was regressed from the previous minor release.
|
||||||
|
|
|
@ -17,8 +17,8 @@ function M.renderCodeBlock(text)
|
||||||
end
|
end
|
||||||
|
|
||||||
for i, line in ipairs(lines) do
|
for i, line in ipairs(lines) do
|
||||||
lines[i] = lunacolors.format('{greyBg}' .. ' ' .. M.highlight(line:sub(0, longest))
|
lines[i] = ' ' .. M.highlight(line:sub(0, longest))
|
||||||
.. string.rep(' ', longest - line:len()) .. ' ')
|
.. string.rep(' ', longest - line:len()) .. ' '
|
||||||
end
|
end
|
||||||
|
|
||||||
return '\n' .. lunacolors.format('{greyBg}' .. table.concat(lines, '\n')) .. '\n'
|
return '\n' .. lunacolors.format('{greyBg}' .. table.concat(lines, '\n')) .. '\n'
|
||||||
|
|
|
@ -61,24 +61,17 @@ function Greenhouse:updateCurrentPage(text)
|
||||||
page:setText(text)
|
page:setText(text)
|
||||||
end
|
end
|
||||||
|
|
||||||
local ansiPatters = {
|
|
||||||
'\x1b%[%d+;%d+;%d+;%d+;%d+%w',
|
|
||||||
'\x1b%[%d+;%d+;%d+;%d+%w',
|
|
||||||
'\x1b%[%d+;%d+;%d+%w',
|
|
||||||
'\x1b%[%d+;%d+%w',
|
|
||||||
'\x1b%[%d+%w'
|
|
||||||
}
|
|
||||||
|
|
||||||
function Greenhouse:sub(str, offset, limit)
|
function Greenhouse:sub(str, offset, limit)
|
||||||
local overhead = 0
|
local overhead = 0
|
||||||
local function addOverhead(s)
|
local function addOverhead(s)
|
||||||
overhead = overhead + string.len(s)
|
overhead = overhead + string.len(s)
|
||||||
end
|
end
|
||||||
|
|
||||||
local s = str
|
local s = str:gsub('\x1b%[%d+;%d+;%d+;%d+;%d+%w', addOverhead)
|
||||||
for _, pat in ipairs(ansiPatters) do
|
:gsub('\x1b%[%d+;%d+;%d+;%d+%w', addOverhead)
|
||||||
s = s:gsub(pat, addOverhead)
|
:gsub('\x1b%[%d+;%d+;%d+%w',addOverhead)
|
||||||
end
|
:gsub('\x1b%[%d+;%d+%w', addOverhead)
|
||||||
|
:gsub('\x1b%[%d+%w', addOverhead)
|
||||||
|
|
||||||
return s:sub(offset, utf8.offset(str, limit + overhead) or limit + overhead)
|
return s:sub(offset, utf8.offset(str, limit + overhead) or limit + overhead)
|
||||||
--return s:sub(offset, limit + overhead)
|
--return s:sub(offset, limit + overhead)
|
||||||
|
@ -101,40 +94,14 @@ function Greenhouse:draw()
|
||||||
self.sink:write(ansikit.getCSI(2, 'J'))
|
self.sink:write(ansikit.getCSI(2, 'J'))
|
||||||
|
|
||||||
local writer = self.sink.writeln
|
local writer = self.sink.writeln
|
||||||
self.attributes = {}
|
|
||||||
for i = offset, offset + self.region.height - 1 do
|
for i = offset, offset + self.region.height - 1 do
|
||||||
local resetEnd = false
|
|
||||||
if i > #lines then break end
|
if i > #lines then break end
|
||||||
|
|
||||||
if i == offset + self.region.height - 1 then writer = self.sink.write end
|
if i == offset + self.region.height - 1 then writer = self.sink.write end
|
||||||
|
|
||||||
self.sink:write(ansikit.getCSI(self.start + i - offset .. ';1', 'H'))
|
self.sink:write(ansikit.getCSI(self.start + i - offset .. ';1', 'H'))
|
||||||
local line = lines[i]:gsub('{separator}', function() return self.separator:rep(self.region.width - 1) end)
|
local line = lines[i]:gsub('{separator}', function() return self.separator:rep(self.region.width - 1) end)
|
||||||
for _, pat in ipairs(ansiPatters) do
|
writer(self.sink, self:sub(line:gsub('\t', ' '), self.horizOffset, self.region.width))
|
||||||
line:gsub(pat, function(s)
|
|
||||||
if s == lunacolors.formatColors.reset then
|
|
||||||
self.attributes = {}
|
|
||||||
resetEnd = true
|
|
||||||
else
|
|
||||||
--resetEnd = false
|
|
||||||
--table.insert(self.attributes, s)
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
|
|
||||||
--[[
|
|
||||||
if #self.attributes ~= 0 then
|
|
||||||
for _, attr in ipairs(self.attributes) do
|
|
||||||
--writer(self.sink, attr)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
]]--
|
|
||||||
|
|
||||||
self.sink:write(lunacolors.formatColors.reset)
|
|
||||||
writer(self.sink, self:sub(line:gsub('\t', ' '), self.horizOffset, self.region.width + self.horizOffset))
|
|
||||||
if resetEnd then
|
|
||||||
self.sink:write(lunacolors.formatColors.reset)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
writer(self.sink, '\27[0m')
|
writer(self.sink, '\27[0m')
|
||||||
self:render()
|
self:render()
|
||||||
|
|
Loading…
Reference in New Issue