Fixing linewrapping bug to do with wordwrapping.
This commit is contained in:
parent
aa2ac0a4ce
commit
6714732222
|
@ -485,7 +485,7 @@ local old_draw_line_body = DocView.draw_line_body
|
||||||
function DocView:draw_line_body(line, x, y)
|
function DocView:draw_line_body(line, x, y)
|
||||||
if not self.wrapped_settings then return old_draw_line_body(self, line, x, y) end
|
if not self.wrapped_settings then return old_draw_line_body(self, line, x, y) end
|
||||||
local lh = self:get_line_height()
|
local lh = self:get_line_height()
|
||||||
local idx0 = get_line_idx_col_count(self, line)
|
local idx0, _, count = get_line_idx_col_count(self, line)
|
||||||
for lidx, line1, col1, line2, col2 in self.doc:get_selections(true) do
|
for lidx, line1, col1, line2, col2 in self.doc:get_selections(true) do
|
||||||
if line >= line1 and line <= line2 then
|
if line >= line1 and line <= line2 then
|
||||||
if line1 ~= line then col1 = 1 end
|
if line1 ~= line then col1 = 1 end
|
||||||
|
@ -493,12 +493,14 @@ function DocView:draw_line_body(line, x, y)
|
||||||
if col1 ~= col2 then
|
if col1 ~= col2 then
|
||||||
local idx1, ncol1 = get_line_idx_col_count(self, line, col1)
|
local idx1, ncol1 = get_line_idx_col_count(self, line, col1)
|
||||||
local idx2, ncol2 = get_line_idx_col_count(self, line, col2)
|
local idx2, ncol2 = get_line_idx_col_count(self, line, col2)
|
||||||
|
local start = 0
|
||||||
for i = idx1, idx2 do
|
for i = idx1, idx2 do
|
||||||
local x1, x2 = x + (idx1 == i and self:get_col_x_offset(line1, col1) or 0)
|
local x1, x2 = x + (idx1 == i and self:get_col_x_offset(line1, col1) or 0)
|
||||||
if idx2 == i then
|
if idx2 == i then
|
||||||
x2 = x + self:get_col_x_offset(line, col2)
|
x2 = x + self:get_col_x_offset(line, col2)
|
||||||
else
|
else
|
||||||
x2 = x + self:get_col_x_offset(line, get_idx_line_length(self, i, line) + 1, true)
|
start = start + get_idx_line_length(self, i, line)
|
||||||
|
x2 = x + self:get_col_x_offset(line, start + 1, true)
|
||||||
end
|
end
|
||||||
renderer.draw_rect(x1, y + (i - idx0) * lh, x2 - x1, lh, style.selection)
|
renderer.draw_rect(x1, y + (i - idx0) * lh, x2 - x1, lh, style.selection)
|
||||||
end
|
end
|
||||||
|
@ -514,7 +516,6 @@ function DocView:draw_line_body(line, x, y)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if draw_highlight then
|
if draw_highlight then
|
||||||
local _, _, count = get_line_idx_col_count(self, line)
|
|
||||||
for i=1,count do
|
for i=1,count do
|
||||||
self:draw_line_highlight(x + self.scroll.x, y + lh * (i - 1))
|
self:draw_line_highlight(x + self.scroll.x, y + lh * (i - 1))
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue