Bundle curated community plugins (2.1.8-4)
Vendored from upstream, pinned by commit (see debian/extra/README.source): - gitstatus, gitopen, fontconfig, open_ext, select_colorscheme, smoothcaret, nerdicons (font mapping patched to DATADIR, Ships the Symbols Nerd Font Mono TTF, SIL OFL 1.1) - lite-xl-lsp (complete LSP client; idle until a language server is configured) plus the lite-xl-widgets library it requires - 104 language syntax plugins (none duplicate the nine bundled in core) settings GUI left out upstream is broken: it requires a libraries.widget.fonts widget that does not exist in lite-xl-widgets at any revision. Co-developed-with: ZCode (Z.ai)
This commit is contained in:
+61
@@ -0,0 +1,61 @@
|
||||
--
|
||||
-- Line Widget.
|
||||
-- @copyright Jefferson Gonzalez
|
||||
-- @license MIT
|
||||
--
|
||||
|
||||
local style = require "core.style"
|
||||
local Widget = require "libraries.widget"
|
||||
|
||||
---@class widget.line : widget
|
||||
---@overload fun(parent?:widget, thickness?:integer, padding?:number):widget.line
|
||||
---@field public padding integer
|
||||
---@field private custom_width number
|
||||
local Line = Widget:extend()
|
||||
|
||||
---Constructor
|
||||
---@param parent widget
|
||||
---@param thickness integer
|
||||
---@param padding number
|
||||
function Line:new(parent, thickness, padding)
|
||||
Line.super.new(self, parent)
|
||||
self.type_name = "widget.line"
|
||||
self.size.y = thickness or 2
|
||||
self.custom_width = nil
|
||||
self.border.width = 0
|
||||
self.padding = padding or (style.padding.x / 2)
|
||||
end
|
||||
|
||||
---Set the thickness of the line
|
||||
---@param thickness number
|
||||
function Line:set_thickness(thickness)
|
||||
self.size.y = thickness or 2
|
||||
end
|
||||
|
||||
---Set a custom width for the line
|
||||
---@param width number
|
||||
function Line:set_width(width)
|
||||
self.custom_width = width
|
||||
self.size.x = width
|
||||
end
|
||||
|
||||
function Line:draw()
|
||||
if not self:is_visible() then return false end
|
||||
|
||||
if not self.custom_width then
|
||||
self.size.x = self.parent.size.x - (self.padding * 2)
|
||||
end
|
||||
|
||||
renderer.draw_rect(
|
||||
self.position.x + self.padding,
|
||||
self.position.y,
|
||||
self.size.x,
|
||||
self.size.y,
|
||||
self.foreground_color or style.caret
|
||||
)
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
|
||||
return Line
|
||||
Reference in New Issue
Block a user