aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/navigate.lua7
-rw-r--r--plugins/selectionhighlight.lua8
2 files changed, 7 insertions, 8 deletions
diff --git a/plugins/navigate.lua b/plugins/navigate.lua
index 5d37e76..2bf4396 100644
--- a/plugins/navigate.lua
+++ b/plugins/navigate.lua
@@ -102,12 +102,7 @@ core.add_thread(function()
current.col = col
end
end
-
- if system.window_has_focus() then
- coroutine.yield(0.5)
- else
- coroutine.yield(config.project_scan_rate)
- end
+ coroutine.yield(0.5)
end
end)
diff --git a/plugins/selectionhighlight.lua b/plugins/selectionhighlight.lua
index fd10239..93ac0fb 100644
--- a/plugins/selectionhighlight.lua
+++ b/plugins/selectionhighlight.lua
@@ -1,6 +1,7 @@
-- mod-version:1 -- lite-xl 1.16
local style = require "core.style"
local DocView = require "core.docview"
+local config = require "core.config"
-- originally written by luveti
@@ -18,13 +19,16 @@ local draw_line_body = DocView.draw_line_body
function DocView:draw_line_body(idx, x, y)
local line1, col1, line2, col2 = self.doc:get_selection(true)
- if line1 == line2 and col1 ~= col2 then
+ local selection = self.doc:get_text(line1, col1, line2, col2)
+ if line1 == line2 and col1 ~= col2 and not selection:match("^%s+$") then
local lh = self:get_line_height()
local selected_text = self.doc.lines[line1]:sub(col1, col2 - 1)
local current_line_text = self.doc.lines[idx]
local last_col = 1
while true do
- local start_col, end_col = current_line_text:find(selected_text, last_col, true)
+ local start_col, end_col = current_line_text:find(
+ selected_text, last_col, true
+ )
if start_col == nil then break end
local x1 = x + self:get_col_x_offset(idx, start_col)
local x2 = x + self:get_col_x_offset(idx, end_col + 1)