diff options
author | Juan Linietsky <reduzio@gmail.com> | 2015-01-03 13:03:13 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2015-01-03 13:03:13 -0300 |
commit | 6b5b95bb4e269a1bd740707e27eae09983b84268 (patch) | |
tree | aa0c80dd4d683eaa99e1ad804d8d742f369bdd73 /scene/gui | |
parent | 85c084c7707c4b9cac978bc0caec0a76b5e37818 (diff) |
-added new code completion guess locations, closes #1032
-moved commandline fix to mingw-only, should fix #1064
Diffstat (limited to 'scene/gui')
-rw-r--r-- | scene/gui/text_edit.cpp | 40 |
1 files changed, 31 insertions, 9 deletions
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 933895a207..8afcbf3283 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -3274,19 +3274,41 @@ void TextEdit::_update_completion_candidates() { String s; - - while(cofs>0 && l[cofs-1]>32 && _is_completable(l[cofs-1])) { - s=String::chr(l[cofs-1])+s; - if (l[cofs-1]=='\'' || l[cofs-1]=='"') - break; - - cofs--; + + //look for keywords first + + bool pre_keyword=false; + + if (cofs>0 && l[cofs-1]==' ') { + int kofs=cofs-1; + String kw; + while (kofs>=0 && l[kofs]==' ') + kofs--; + + while(kofs>=0 && l[kofs]>32 && _is_completable(l[kofs])) { + kw=String::chr(l[kofs])+kw; + kofs--; + } + + pre_keyword=keywords.has(kw); + print_line("KW "+kw+"? "+itos(pre_keyword)); + + } else { + + + while(cofs>0 && l[cofs-1]>32 && _is_completable(l[cofs-1])) { + s=String::chr(l[cofs-1])+s; + if (l[cofs-1]=='\'' || l[cofs-1]=='"') + break; + + cofs--; + } } - + update(); - if (s=="" && (cofs==0 || !completion_prefixes.has(String::chr(l[cofs-1])))) { + if (!pre_keyword && s=="" && (cofs==0 || !completion_prefixes.has(String::chr(l[cofs-1])))) { //none to complete, cancel _cancel_completion(); return; |