From 284400afaa1121f826dc57a2e991c4aa800a0181 Mon Sep 17 00:00:00 2001 From: Dan Date: Sat, 14 Dec 2024 23:54:06 -0500 Subject: [PATCH] Rename variable 'string' to 'str' --- lua/scrollview.lua | 20 ++++++++++---------- lua/scrollview/signs/conflicts.lua | 8 ++++---- lua/scrollview/signs/textwidth.lua | 4 ++-- lua/scrollview/signs/trail.lua | 4 ++-- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/lua/scrollview.lua b/lua/scrollview.lua index 9bbf66f..6dad537 100644 --- a/lua/scrollview.lua +++ b/lua/scrollview.lua @@ -2093,8 +2093,8 @@ local read_input_stream = function() break end end - local string = table.concat(chars, '') - local result = {string, chars_props} + local str = table.concat(chars, '') + local result = {str, chars_props} return unpack(result) end @@ -2829,7 +2829,7 @@ local handle_mouse = function(button, primary) local scrollbar_offset local previous_row local idx = 1 - local string, chars_props = '', {} + local str, chars_props = '', {} local str_idx, char, mouse_winid, mouse_row, mouse_col local props -- Computing this prior to the first mouse event could distort the location @@ -2844,7 +2844,7 @@ local handle_mouse = function(button, primary) idx = idx + 1 if idx > #chars_props then idx = 1 - string, chars_props = read_input_stream() + str, chars_props = read_input_stream() end local char_props = chars_props[idx] str_idx = char_props.str_idx @@ -2866,7 +2866,7 @@ local handle_mouse = function(button, primary) end end if char == t'' then - fn.feedkeys(string.sub(string, str_idx + #char), 'ni') + fn.feedkeys(string.sub(str, str_idx + #char), 'ni') return end -- In select-mode, mouse usage results in the mode intermediately @@ -2882,18 +2882,18 @@ local handle_mouse = function(button, primary) if char ~= '\x80\xf5X' or count == 0 then if mouse_winid == 0 then -- There was no mouse event. - fn.feedkeys(string.sub(string, str_idx), 'ni') + fn.feedkeys(string.sub(str, str_idx), 'ni') return end if char == mouseup then if count == 0 then -- No initial mousedown was captured. - fn.feedkeys(string.sub(string, str_idx), 'ni') + fn.feedkeys(string.sub(str, str_idx), 'ni') elseif count == 1 then -- A scrollbar was clicked, but there was no corresponding drag. -- Allow the interaction to be processed as it would be with no -- scrollbar. - fn.feedkeys(mousedown .. string.sub(string, str_idx), 'ni') + fn.feedkeys(mousedown .. string.sub(str, str_idx), 'ni') else -- A scrollbar was clicked and there was a corresponding drag. -- 'feedkeys' is not called, since the full mouse interaction has @@ -2913,7 +2913,7 @@ local handle_mouse = function(button, primary) if count == 0 then if mouse_winid < 0 then -- The mouse event was on the tabline or command line. - fn.feedkeys(string.sub(string, str_idx), 'ni') + fn.feedkeys(string.sub(str, str_idx), 'ni') return end props = get_scrollview_bar_props(mouse_winid) @@ -2941,7 +2941,7 @@ local handle_mouse = function(button, primary) if not clicked_bar and not clicked_sign then -- There was either no scrollbar or signs in the window where a -- click occurred or the click was not on a scrollbar or sign. - fn.feedkeys(string.sub(string, str_idx), 'ni') + fn.feedkeys(string.sub(str, str_idx), 'ni') return end if clicked_sign and primary then diff --git a/lua/scrollview/signs/conflicts.lua b/lua/scrollview/signs/conflicts.lua index f4b171b..f4882f0 100644 --- a/lua/scrollview/signs/conflicts.lua +++ b/lua/scrollview/signs/conflicts.lua @@ -70,13 +70,13 @@ function M.init(enable) local line_count = api.nvim_buf_line_count(bufnr) for line = 1, line_count do local match = false - local string = fn.getbufline(bufnr, line)[1] + local str = fn.getbufline(bufnr, line)[1] if position == TOP then - match = vim.startswith(string, '<<<<<<< ') + match = vim.startswith(str, '<<<<<<< ') elseif position == MIDDLE then - match = string == '=======' + match = str == '=======' elseif position == BOTTOM then - match = vim.startswith(string, '>>>>>>> ') + match = vim.startswith(str, '>>>>>>> ') else error('Unknown position: ' .. position) end diff --git a/lua/scrollview/signs/textwidth.lua b/lua/scrollview/signs/textwidth.lua index 723dfb6..ac20971 100644 --- a/lua/scrollview/signs/textwidth.lua +++ b/lua/scrollview/signs/textwidth.lua @@ -45,8 +45,8 @@ function M.init(enable) if textwidth > 0 then api.nvim_win_call(winid, function() for line = 1, line_count do - local string = fn.getbufline(bufnr, line)[1] - local line_length = fn.strchars(string, 1) + local str = fn.getbufline(bufnr, line)[1] + local line_length = fn.strchars(str, 1) if line_length > textwidth then table.insert(lines, line) end diff --git a/lua/scrollview/signs/trail.lua b/lua/scrollview/signs/trail.lua index bdcda3d..d77ba73 100644 --- a/lua/scrollview/signs/trail.lua +++ b/lua/scrollview/signs/trail.lua @@ -42,8 +42,8 @@ function M.init(enable) else local line_count = api.nvim_buf_line_count(bufnr) for line = 1, line_count do - local string = fn.getbufline(bufnr, line)[1] - if string.match(string, "%s$") then + local str = fn.getbufline(bufnr, line)[1] + if string.match(str, "%s$") then table.insert(lines, line) end end