mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-01-26 08:56:54 +00:00
Adds support for colon operator in complete() function.
Includes changes to lua and edit programs to correctly support that too.
This commit is contained in:
parent
7e08662b95
commit
1489da1f5f
@ -353,8 +353,19 @@ function complete( sSearchText, tSearchTable )
|
||||
return tEmpty
|
||||
end
|
||||
end
|
||||
|
||||
local sPart = string.sub( sSearchText, nStart, nDot )
|
||||
local nColon = string.find( sSearchText, ":", nStart, true )
|
||||
if nColon then
|
||||
local sPart = string.sub( sSearchText, nStart, nColon - 1 )
|
||||
local value = tTable[ sPart ]
|
||||
if type( value ) == "table" then
|
||||
tTable = value
|
||||
nStart = nColon + 1
|
||||
else
|
||||
return tEmpty
|
||||
end
|
||||
end
|
||||
|
||||
local sPart = string.sub( sSearchText, nStart )
|
||||
local nPartLength = string.len( sPart )
|
||||
|
||||
local tResults = {}
|
||||
|
@ -204,7 +204,7 @@ local nCompletion
|
||||
local tCompleteEnv = _ENV
|
||||
local function complete( sLine )
|
||||
if settings.get( "edit.autocomplete" ) then
|
||||
local nStartPos = string.find( sLine, "[a-zA-Z0-9_%.]+$" )
|
||||
local nStartPos = string.find( sLine, "[a-zA-Z0-9_%.:]+$" )
|
||||
if nStartPos then
|
||||
sLine = string.sub( sLine, nStartPos )
|
||||
end
|
||||
|
@ -34,7 +34,7 @@ while bRunning do
|
||||
|
||||
local s = read( nil, tCommandHistory, function( sLine )
|
||||
if settings.get( "lua.autocomplete" ) then
|
||||
local nStartPos = string.find( sLine, "[a-zA-Z0-9_%.]+$" )
|
||||
local nStartPos = string.find( sLine, "[a-zA-Z0-9_%.:]+$" )
|
||||
if nStartPos then
|
||||
sLine = string.sub( sLine, nStartPos )
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user