Work on Open

This commit is contained in:
Krzosa Karol
2024-08-03 19:11:36 +02:00
parent 0c4dc62170
commit 815e3c9670
12 changed files with 192 additions and 96 deletions

View File

@@ -253,7 +253,18 @@ function ExtractLineAndColumn(s)
end
end
return 0, 0, s
return -1, -1, s
end
function BufferNameExists(name)
buffers = ListBuffers()
for i = 1,#buffers do
buff = buffers[i]
if buff == name then
return true
end
end
return false
end
function GenericTextFileRule(_s)
@@ -286,8 +297,12 @@ function GenericTextFileRule(_s)
return s
end
if BufferNameExists(s) then
return s
end
-- other_random_filename
return s
return GetCurrentBufferDir()..'/'..s
end
line, col, _s = ExtractLineAndColumn(_s)
@@ -295,21 +310,6 @@ function GenericTextFileRule(_s)
return {kind = "text", file_path = file_path, line = line, col = col}
end
-- function RuleFindExistingBuffer(_s)
-- line, col, _s = ExtractLineAndColumn(_s)
--
-- buffers = list_buffers_object()
-- for i = 1,#buffers do
-- buff = buffers[i]
-- if buff == _s then
-- return {kind = "text", file_path = buff, line = line, col = col}
-- end
-- end
--
-- return nil
-- end
Rules = {}
Rules[#Rules + 1] = GenericTextFileRule
-- Rules[#Rules + 2] = RuleFindExistingBuffer
@@ -397,7 +397,7 @@ void GenerateConfig() {
Array<Var> style = {};
style.add({"DrawLineNumbers", "1"});
style.add({"DrawScrollbar", "1"});
style.add({"IndentSize", "2"});
style.add({"IndentSize", "4"});
style.add({"TrimWhitespaceOnSave", "1"});
{