fix: typo (#997)

This commit is contained in:
Zhizhen He 2023-03-30 12:12:37 +08:00 committed by GitHub
parent f7b3daf1ae
commit 6bb1f80a98
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 45 additions and 47 deletions

View File

@ -29,7 +29,7 @@ Good luck!
*Let's introduce you to the tools we use.*
- Your PR needs to pass tests & linter. We lint our codebase with [luacheck](https://github.com/mpeterv/luacheck)
and run tests with [plenary-test][plenary.nvim] these will be ran on CI. If you want you can run tests & linter
and run tests with [plenary-test][plenary.nvim] these will be run on CI. If you want you can run tests & linter
locally with `make test` & `make lint` respectively. Or `make check` to run both linter & tests. For running
tests you'll have to make sure lualine.nvim, [plenary.nvim][plenary.nvim] and
[nvim-web-devicons](https://github.com/kyazdani42/nvim-web-devicons) are in same directory.

View File

@ -470,7 +470,7 @@ sections = {
#### Component specific options
These are options that are available on specific components.
For example you have option on `diagnostics` component to
For example, you have option on `diagnostics` component to
specify what your diagnostic sources will be.
#### buffers component options
@ -867,7 +867,7 @@ require('lualine').setup { extensions = { my_extension } }
### Refreshing lualine
By default lualine refreshes itself based on timer and some events. You can set
the interval of the timer with refresh option. However you can also force
lualine to refresh at any time by calling lualine.refresh function.
lualine to refresh at any time by calling `lualine.refresh` function.
```lua
require('lualine').refresh({
scope = 'tabpage', -- scope of refresh all/tabpage/window
@ -882,7 +882,7 @@ So you can simply do
require('lualine').refresh()
```
Avoid calling lualine.refresh inside components. Since components are evaluated
Avoid calling `lualine.refresh` inside components. Since components are evaluated
during refresh, calling refresh while refreshing can have undesirable effects.
### Disabling lualine

View File

@ -54,7 +54,7 @@ But if `g:ayuprefermirage` exists, it will load ayu_mirage instead when
### base16
This theme will automatically uses colors defined by your colorscheme using [RRethy/nvim-base16](https://github.com/RRethy/nvim-base16)] plugin.
This theme will automatically use colors defined by your colorscheme using [RRethy/nvim-base16](https://github.com/RRethy/nvim-base16)] plugin.
The following example is using the `tomorrow-night` colorscheme:
<p>

View File

@ -73,7 +73,7 @@ local function ins_left(component)
table.insert(config.sections.lualine_c, component)
end
-- Inserts a component in lualine_x ot right section
-- Inserts a component in lualine_x at right section
local function ins_right(component)
table.insert(config.sections.lualine_x, component)
end

View File

@ -358,7 +358,7 @@ local function refresh(opts)
local wins = {}
local old_actual_curwin = vim.g.actual_curwin
-- ignore focus on filetypes listes in options.ignore_focus
-- ignore focus on filetypes listed in options.ignore_focus
local curwin = vim.api.nvim_get_current_win()
local curtab = vim.api.nvim_get_current_tabpage()
if last_focus[curtab] == nil or not vim.api.nvim_win_is_valid(last_focus[curtab]) then

View File

@ -201,7 +201,7 @@ function M:apply_section_separators()
end
end
---Add on click funtion description to already drawn item
---Add on click function description to already drawn item
function M:apply_on_click()
if self.on_click_id then
self.status = self:format_fn(self.on_click_id, self.status)

View File

@ -84,7 +84,7 @@ end
---updates the job args
function M.update_diff_args()
-- Donn't show git diff when current buffer doesn't have a filename
-- Don't show git diff when current buffer doesn't have a filename
active_bufnr = tostring(vim.api.nvim_get_current_buf())
if #vim.fn.expand('%') == 0 then
M.diff_args = nil
@ -121,7 +121,7 @@ function M.update_diff_args()
M.update_git_diff()
end
---update git_diff veriable
---update git_diff variable
function M.update_git_diff()
if M.diff_args then
diff_output_cache = {}

View File

@ -183,7 +183,7 @@ function M.highlight(name, foreground, background, gui, link)
}
end
---Attach a hl to another, so the attachee auto updates on change to hl that it's attached too.
---Attach a hl to another, so the attached auto updates on change to hl that it's attached too.
---@param provider string the hl receiver is getting attached to
---@param receiver string the hl that will be auto updated upon change to provider
---@param provider_el_type string (fg/bg) what element receiver relates to of provider
@ -328,7 +328,7 @@ function M.create_component_highlight_group(color, highlight_tag, options, apply
end
if type(color) ~= 'function' and (apply_no_default or (color.bg and color.fg)) then
-- When bg and fg are both present we donn't need to set highlighs for
-- When bg and fg are both present we don't need to set highlights for
-- each mode as they will surely look the same. So we can work without options
local highlight_group_name = table.concat({ 'lualine', section, highlight_tag }, '_')
M.highlight(highlight_group_name, color.fg, color.bg, color.gui, nil)

View File

@ -70,11 +70,11 @@ local function clamp(val, left, right)
end
-- Changes brightness of rgb_color by percentage
local function brightness_modifier(rgb_color, parcentage)
local function brightness_modifier(rgb_color, percentage)
local color = rgb_str2num(rgb_color)
color.red = clamp(color.red + (color.red * parcentage / 100), 0, 255)
color.green = clamp(color.green + (color.green * parcentage / 100), 0, 255)
color.blue = clamp(color.blue + (color.blue * parcentage / 100), 0, 255)
color.red = clamp(color.red + (color.red * percentage / 100), 0, 255)
color.green = clamp(color.green + (color.green * percentage / 100), 0, 255)
color.blue = clamp(color.blue + (color.blue * percentage / 100), 0, 255)
return rgb_num2str(color)
end
@ -90,19 +90,17 @@ end
-- Changes brightness of foreground color to achieve contrast
-- without changing the color
local function apply_contrast(highlight)
local hightlight_bg_avg = get_color_avg(highlight.bg)
local highlight_bg_avg = get_color_avg(highlight.bg)
local contrast_threshold_config = clamp(contrast_threshold, 0, 0.5)
local contranst_change_step = 5
if hightlight_bg_avg > 0.5 then
contranst_change_step = -contranst_change_step
local contrast_change_step = 5
if highlight_bg_avg > 0.5 then
contrast_change_step = -contrast_change_step
end
-- Don't waste too much time here max 25 iteration should be more than enough
local iteration_count = 1
while
math.abs(get_color_avg(highlight.fg) - hightlight_bg_avg) < contrast_threshold_config and iteration_count < 25
do
highlight.fg = contrast_modifier(highlight.fg, contranst_change_step)
while math.abs(get_color_avg(highlight.fg) - highlight_bg_avg) < contrast_threshold_config and iteration_count < 25 do
highlight.fg = contrast_modifier(highlight.fg, contrast_change_step)
iteration_count = iteration_count + 1
end
end

View File

@ -15,7 +15,7 @@ function M.register_fn(id, fn)
end
---Get the function with id
---@param id number id of the fn to retrive
---@param id number id of the fn to retrieve
---@return function
function M.get_fn(id)
vim.validate { id = { id, 'n' } }

View File

@ -243,7 +243,7 @@ local function load_theme(theme_name)
end
if not file_found then
-- This shouldn't happen but somehow we have multiple files but they
-- apear to be in lualines repo . Just run the first one
-- appear to be in lualines repo . Just run the first one
retval = dofile(files[1])
end
end

View File

@ -12,7 +12,7 @@ local highlight = require('lualine.highlight')
---@param section table list of components
---@param section_name string used for getting proper hl
---@param is_focused boolean
---@return string formated string for a section
---@return string formatted string for a section
--TODO Clean this up this does lots of messy stuff.
function M.draw_section(section, section_name, is_focused)
local highlight_name = highlight.format_highlight(section_name, is_focused)
@ -21,7 +21,7 @@ function M.draw_section(section, section_name, is_focused)
for _, component in pairs(section) do
-- load components into status table
if type(component) ~= 'table' or (type(component) == 'table' and not component.component_no) then
return '' -- unknown element in section. section posibly not yet loaded
return '' -- unknown element in section. section possibly not yet loaded
end
table.insert(status, component:draw(highlight_name, is_focused))
end
@ -81,14 +81,14 @@ function M.draw_section(section, section_name, is_focused)
end
end
local left_sparator_string = ''
local left_separator_string = ''
if
section_name > 'x'
and section[first_component_no]
and type(section[first_component_no].options.separator) ~= 'table'
and (section[1].options.section_separators.right ~= nil and section[1].options.section_separators.right ~= '')
then
left_sparator_string = string.format(
left_separator_string = string.format(
'%%s{%s}',
section[first_component_no].options.ls_separator or section[1].options.section_separators.right
)
@ -107,17 +107,17 @@ function M.draw_section(section, section_name, is_focused)
local find_start_trans_sep_start, find_start_trans_sep_end = status_str:find('^%%s{.-}')
if find_start_trans_sep_start then
-- the section doesn't need to be prepended with default hl when sections
-- first component has trasitionals sep
-- first component has transitional sep
needs_hl = status_str:find('^%%#', find_start_trans_sep_end + 1)
else
needs_hl = status_str:find('^%%#')
end
if needs_hl then
-- Don't prepend with old highlight when the component changes it imidiately
return left_sparator_string .. status_str
-- Don't prepend with old highlight when the component changes it immediately
return left_separator_string .. status_str
else
return left_sparator_string .. highlight_name .. status_str
return left_separator_string .. highlight_name .. status_str
end
end

View File

@ -191,13 +191,13 @@ function M.stl_escape(str)
return str:gsub('%%', '%%%%')
end
---A safe call inside a timmer
---A safe call inside a timer
---@param timer userdata
---@param augroup string|nil autocmd group to reset too on error.
---@param fn function
---@param max_err integer
---@param err_msg string
---@return function a wraped fn that can be called inside a timer and that
---@return function a wrapped fn that can be called inside a timer and that
---stops the timer after max_err errors in calling fn
function M.timer_call(timer, augroup, fn, max_err, err_msg)
local err_cnt, ret = 0, nil

View File

@ -16,7 +16,7 @@ if source:sub(1, 1) == '@' then
end
end
--- checks if name is valied
--- checks if name is valid
---@param name string
---@return boolean
function M.is_valid_filename(name)

View File

@ -35,7 +35,7 @@ M.assert_component = function(component, opts, result, is_active)
eq(result, comp:draw(opts.hl, is_active or true))
end
function M.assert_component_instence(comp, result)
function M.assert_component_instance(comp, result)
eq(result, comp:draw(comp.options.hl))
end
-- sets defaults for component options

View File

@ -757,7 +757,7 @@ describe('Branch component', function()
"git -c user.name='asdf' -c user.email='asdf@jlk.org' -C " .. tmpdir .. ' ' .. string.format(...)
)
end
local assert_comp_ins = helpers.assert_component_instence
local assert_comp_ins = helpers.assert_component_instance
before_each(function()
tmpdir = os.tmpname()

View File

@ -73,7 +73,7 @@ describe('config parsing', function()
eq(config.options.section_separators, { left = 'b', right = 'a' })
end)
end)
it('no seprarators', function()
it('no separators', function()
local config = {
options = { component_separators = {}, section_separators = {} },
}

View File

@ -26,7 +26,7 @@ describe('Lualine', function()
statusline = 1000,
tabline = 1000,
winbar = 1000,
}
},
},
sections = {
lualine_a = { 'mode' },
@ -102,7 +102,7 @@ describe('Lualine', function()
]===])
end)
it('get_config can retrive config', function()
it('get_config can retrieve config', function()
eq(config, require('lualine').get_config())
end)
@ -207,7 +207,7 @@ describe('Lualine', function()
]===])
end)
it('mid divider can be disbled on special case', function()
it('mid divider can be disabled on special case', function()
config.options.always_divide_middle = false
config.sections.lualine_x = {}
config.sections.lualine_y = {}

View File

@ -10,7 +10,7 @@ local stub = require('luassert.stub')
describe('Utils', function()
local utils = require('lualine.utils.utils')
it('can retrive highlight groups', function()
it('can retrieve highlight groups', function()
local hl2 = { fg = '#aabbcc', bg = '#889977', sp = '#997788', reverse = true, undercurl = true }
-- handles non existing hl groups
eq(utils.extract_highlight_colors('hl2'), nil)
@ -79,7 +79,7 @@ describe('Utils', function()
end)
end)
describe('Cterm genarator', function()
describe('Cterm generator', function()
local cterm = require('lualine.utils.color_utils')
it('can convert rgb to cterm', function()
@ -90,7 +90,7 @@ describe('Cterm genarator', function()
end)
end)
describe('Section genarator', function()
describe('Section generator', function()
local hl = require('lualine.highlight')
stub(hl, 'format_highlight')
hl.format_highlight.returns('%#lualine_c_normal#')

View File

@ -42,7 +42,7 @@
---]===])
--- ```
---
--- For more flexibility you can match a patten in expect block.
--- For more flexibility you can match a pattern in expect block.
--- ``lua
--- statusline:expect([===[
--- highlights = {