forked from cerc-io/plugeth
console, internal/jsre: fix autocomplete issues (#26518)
Fixes #26505 where the console crashed when a property getter raised an exception during autocompletion. I also noticed while fixing this issue that autocomplete wasn't working for objects/fields with numbers in them (most importantly web3.<tab><tab>) which is also now fixed.
This commit is contained in:
+2
-6
@@ -305,12 +305,8 @@ func (c *Console) AutoCompleteInput(line string, pos int) (string, []string, str
|
||||
start := pos - 1
|
||||
for ; start > 0; start-- {
|
||||
// Skip all methods and namespaces (i.e. including the dot)
|
||||
if line[start] == '.' || (line[start] >= 'a' && line[start] <= 'z') || (line[start] >= 'A' && line[start] <= 'Z') {
|
||||
continue
|
||||
}
|
||||
// Handle web3 in a special way (i.e. other numbers aren't auto completed)
|
||||
if start >= 3 && line[start-3:start] == "web3" {
|
||||
start -= 3
|
||||
c := line[start]
|
||||
if c == '.' || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '1' && c <= '9') {
|
||||
continue
|
||||
}
|
||||
// We've hit an unexpected character, autocomplete form here
|
||||
|
||||
Reference in New Issue
Block a user