1

Add line max

This commit is contained in:
Alex Yatskov 2024-05-02 20:21:29 -07:00
parent 0deb8db17e
commit 66400690bf
2 changed files with 9 additions and 0 deletions

View File

@ -6,6 +6,7 @@ local opt_curr = {
comma_last = false, comma_last = false,
comma_prefix = false, comma_prefix = false,
comma_prefix_indent = false, comma_prefix_indent = false,
line_max = 16,
line_prefix = '', line_prefix = '',
trim_inner_spaces = true, trim_inner_spaces = true,
}, },

View File

@ -191,6 +191,10 @@ function BraceRange.find_closest_any()
end end
end end
function BraceRange:get_rows()
return self.stop.row - self.start.row
end
function BraceRange:is_wrapped() function BraceRange:is_wrapped()
return self.start.row < self.stop.row return self.start.row < self.stop.row
end end
@ -466,6 +470,10 @@ function WrapContext:parse()
self:config_opt() self:config_opt()
if self.range:get_rows() > self.opt.line_max then
return false
end
local first_line = vim.fn.getline(self.range.start.row) local first_line = vim.fn.getline(self.range.start.row)
local last_line = vim.fn.getline(self.range.stop.row) local last_line = vim.fn.getline(self.range.stop.row)
self:config_indent(first_line) self:config_indent(first_line)