aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuldoman <giulio.lettieri@gmail.com>2021-09-05 02:50:37 +0200
committerGuldoman <giulio.lettieri@gmail.com>2021-09-05 02:50:37 +0200
commite2c107b6f7a2567ef681adda9c127410c0084e0e (patch)
treeebb812c6823b85e9f4fa2b223728b0650cb4291f
parent73affe215f96bfde8bccc7d0c338b495bb61a580 (diff)
downloadlite-xl-e2c107b6f7a2567ef681adda9c127410c0084e0e.tar.gz
lite-xl-e2c107b6f7a2567ef681adda9c127410c0084e0e.zip
Revert "Merge pull request #481 from Guldoman/h_scroll_size_cache"
This reverts commit a0508103b1cbcdfe1936de41b1a167243406c481, reversing changes made to f18629ab640423807ec44fb9163a0222ad850aae.
-rw-r--r--data/core/docview.lua15
1 files changed, 4 insertions, 11 deletions
diff --git a/data/core/docview.lua b/data/core/docview.lua
index cddd82d2..8f8c77ff 100644
--- a/data/core/docview.lua
+++ b/data/core/docview.lua
@@ -102,17 +102,10 @@ function DocView:get_scrollable_size()
end
function DocView:get_h_scrollable_size()
- local doc_change_id = self.doc:get_change_id()
- if self.last_doc_change_id ~= doc_change_id then
- self.last_doc_change_id = doc_change_id
- local xmargin = 3 * self:get_font():get_width(' ') -- from DocView:scroll_to_make_visible
- -- TODO: make Doc calculate the real longest line in pixels, not in characters,
- -- as the current implementation only works for monospace fonts
- local long_line = next(self.doc.long_lines.line_numbers) or 1
- self.h_scrollable_size = self:get_col_x_offset(long_line, self.doc.long_lines.length)
- + self:get_gutter_width() + xmargin
- end
- return self.h_scrollable_size
+ local xmargin = 3 * self:get_font():get_width(' ') -- from DocView:scroll_to_make_visible
+ local long_line = next(self.doc.long_lines.line_numbers) or 1
+ return self:get_col_x_offset(long_line, self.doc.long_lines.length)
+ + self:get_gutter_width() + xmargin
end
function DocView:get_font()