mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[apps/code] Load builtins according to autocompleted text
This commit is contained in:
@@ -53,8 +53,13 @@ static inline size_t TokenLength(mp_lexer_t * lex, const char * tokenPosition) {
|
||||
return lex->column - lex->tok_column;
|
||||
}
|
||||
|
||||
const char * PythonTextArea::ContentView::textToAutocomplete() const {
|
||||
return UTF8Helper::BeginningOfWord(editedText(), cursorLocation());
|
||||
const char * PythonTextArea::ContentView::textToAutocomplete(int * length) const {
|
||||
const char * result = UTF8Helper::BeginningOfWord(editedText(), cursorLocation());
|
||||
if (length != nullptr) {
|
||||
*length = cursorLocation() - result;
|
||||
assert(*length > 0);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void PythonTextArea::ContentView::loadSyntaxHighlighter() {
|
||||
@@ -235,11 +240,11 @@ bool PythonTextArea::handleEventWithText(const char * text, bool indentation, bo
|
||||
return result;
|
||||
}
|
||||
|
||||
const char * PythonTextArea::textToAutocomplete() const {
|
||||
const char * PythonTextArea::textToAutocomplete(int * length) const {
|
||||
if (!m_contentView.isAutocompleting()) {
|
||||
return nullptr;
|
||||
}
|
||||
return m_contentView.textToAutocomplete();
|
||||
return m_contentView.textToAutocomplete(length);
|
||||
}
|
||||
|
||||
void PythonTextArea::removeAutocompletion() {
|
||||
|
||||
Reference in New Issue
Block a user