From bf09582478a472942688d1f5f01a251de5f6caeb Mon Sep 17 00:00:00 2001 From: Adam Harrison Date: Sat, 1 May 2021 01:46:06 -0400 Subject: [PATCH] Fixed lines to conform to style guidelines. --- data/core/regex.lua | 12 +++++++++--- data/plugins/regex_find_replace.lua | 12 ++++++++---- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/data/core/regex.lua b/data/core/regex.lua index 83ba9378..7704c14e 100644 --- a/data/core/regex.lua +++ b/data/core/regex.lua @@ -9,7 +9,8 @@ regex.match = function(pattern_string, string) return regex.cmatch(pattern, string) end --- Will iterate back through any UTF-8 bytes so that we don't replace bits mid character. +-- Will iterate back through any UTF-8 bytes so that we don't replace bits +-- mid character. local function previous_character(str, index) local byte repeat @@ -44,12 +45,17 @@ regex.gsub = function(pattern_string, string, replacement) local currentReplacement = replacement if #indices > 2 then for i = 1, (#indices/2 - 1) do - currentReplacement = string.gsub(currentReplacement, "\\" .. i, str:sub(indices[i*2+1], end_character(str,indices[i*2+2]-1))) + currentReplacement = string.gsub( + currentReplacement, + "\\" .. i, + str:sub(indices[i*2+1], end_character(str,indices[i*2+2]-1)) + ) end end currentReplacement = string.gsub(currentReplacement, "\\%d", "") if indices[1] > 1 then - result = result .. str:sub(1, previous_character(str, indices[1])) .. currentReplacement + result = result .. + str:sub(1, previous_character(str, indices[1])) .. currentReplacement else result = result .. currentReplacement end diff --git a/data/plugins/regex_find_replace.lua b/data/plugins/regex_find_replace.lua index 7d804f58..65eea074 100644 --- a/data/plugins/regex_find_replace.lua +++ b/data/plugins/regex_find_replace.lua @@ -47,10 +47,14 @@ local initial_regex_replace = "/" command.add("core.docview", { ["regex:find-replace"] = function() core.command_view:set_text(initial_regex_replace) - core.command_view:enter("Regex Replace (enter pattern as /old/new/)", function(pattern) - regex_replace_file(pattern) - initial_regex_replace = pattern - end) end + core.command_view:enter( + "Regex Replace (enter pattern as /old/new/)", + function(pattern) + regex_replace_file(pattern) + initial_regex_replace = pattern + end + ) + end })