Skip to content

Commit

Permalink
fix: center title and version in emptyview (lite-xl#1311)
Browse files Browse the repository at this point in the history
* fix: divide by amount of lines
  • Loading branch information
TorchedSammy authored Jan 6, 2023
1 parent aa50366 commit 1504ad7
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions data/core/emptyview.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,15 @@ local View = require "core.view"
local EmptyView = View:extend()

local function draw_text(x, y, color)
local lines = {
{ fmt = "%s to run a command", cmd = "core:find-command" },
{ fmt = "%s to open a file from the project", cmd = "core:find-file" },
{ fmt = "%s to change project folder", cmd = "core:change-project-folder" },
{ fmt = "%s to open a project folder", cmd = "core:open-project-folder" },
}
local th = style.big_font:get_height()
local dh = 2 * th + style.padding.y * 2
local x1, y1 = x, y + (dh - th) / 2
local x1, y1 = x, y + ((dh - th) / #lines)
local xv = x1
local title = "Lite XL"
local version = "version " .. VERSION
Expand All @@ -24,12 +30,6 @@ local function draw_text(x, y, color)
renderer.draw_text(style.font, version, xv, y1 + th, color)
x = x + style.padding.x
renderer.draw_rect(x, y, math.ceil(1 * SCALE), dh, color)
local lines = {
{ fmt = "%s to run a command", cmd = "core:find-command" },
{ fmt = "%s to open a file from the project", cmd = "core:find-file" },
{ fmt = "%s to change project folder", cmd = "core:change-project-folder" },
{ fmt = "%s to open a project folder", cmd = "core:open-project-folder" },
}
th = style.font:get_height()
y = y + (dh - (th + style.padding.y) * #lines) / 2
local w = 0
Expand Down

0 comments on commit 1504ad7

Please sign in to comment.