aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancesco Abbate <francesco.bbt@gmail.com>2021-12-31 00:22:49 +0100
committerFrancesco Abbate <francesco.bbt@gmail.com>2021-12-31 00:22:49 +0100
commit445c79bb52120fa874dbc711aa1d4390c4d02848 (patch)
tree1cb93ccff909e699b8c571412846ee0dc5e14108
parent03350cc14b44e8734af8419535a99bebea11fae6 (diff)
downloadlite-xl-445c79bb52120fa874dbc711aa1d4390c4d02848.tar.gz
lite-xl-445c79bb52120fa874dbc711aa1d4390c4d02848.zip
Revert "No longer store autocomplete options in config"
This reverts commit 0f1b84040dd823823c17e925e1ed10380b7737c1. The new mechanism to save config.plugins upon user's configuration reload let us stay compatible with existing plugins.
-rw-r--r--data/plugins/autocomplete.lua12
1 files changed, 6 insertions, 6 deletions
diff --git a/data/plugins/autocomplete.lua b/data/plugins/autocomplete.lua
index d324733f..fde9487e 100644
--- a/data/plugins/autocomplete.lua
+++ b/data/plugins/autocomplete.lua
@@ -10,7 +10,7 @@ local RootView = require "core.rootview"
local DocView = require "core.docview"
local Doc = require "core.doc"
-local autocomplete_options = {
+config.plugins.autocomplete = {
-- Amount of characters that need to be written for autocomplete
min_len = 3,
-- The max amount of visible items
@@ -192,7 +192,7 @@ local function update_suggestions()
-- fuzzy match, remove duplicates and store
items = common.fuzzy_match(items, partial)
local j = 1
- for i = 1, autocomplete_options.max_suggestions do
+ for i = 1, config.plugins.autocomplete.max_suggestions do
suggestions[i] = items[j]
while items[j] and items[i].text == items[j].text do
items[i].info = items[i].info or items[j].info
@@ -235,7 +235,7 @@ local function get_suggestions_rect(av)
max_width = math.max(max_width, w)
end
- local ah = autocomplete_options.max_height
+ local ah = config.plugins.autocomplete.max_height
local max_items = #suggestions
if max_items > ah then
@@ -294,7 +294,7 @@ local function draw_suggestions_box(av)
return
end
- local ah = autocomplete_options.max_height
+ local ah = config.plugins.autocomplete.max_height
-- draw background rect
local rx, ry, rw, rh = get_suggestions_rect(av)
@@ -355,7 +355,7 @@ local function show_autocomplete()
-- update partial symbol and suggestions
partial = get_partial_symbol()
- if #partial >= autocomplete_options.min_len or triggered_manually then
+ if #partial >= config.plugins.autocomplete.min_len or triggered_manually then
update_suggestions()
if not triggered_manually then
@@ -469,7 +469,7 @@ function autocomplete.complete(completions, on_close)
end
function autocomplete.can_complete()
- if #partial >= autocomplete_options.min_len then
+ if #partial >= config.plugins.autocomplete.min_len then
return true
end
return false