diff options
author | Juan Linietsky <reduzio@gmail.com> | 2015-08-25 23:00:11 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2015-08-25 23:00:11 -0300 |
commit | d50921b55089e0396ee5f11675b6093dd49b7cbb (patch) | |
tree | f3ecf2178ddadd4d507008061feb158d6e91e98c /core/ustring.cpp | |
parent | 04cb3c9eb13b3824f676bc29e037802bffc3bdac (diff) | |
download | redot-engine-d50921b55089e0396ee5f11675b6093dd49b7cbb.tar.gz |
Show documentation for properties on hover.
This works if the property has been documented (about half are at this point)
Diffstat (limited to 'core/ustring.cpp')
-rw-r--r-- | core/ustring.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/core/ustring.cpp b/core/ustring.cpp index 3cfc1e4a3c..32ef1eb5ff 100644 --- a/core/ustring.cpp +++ b/core/ustring.cpp @@ -3048,6 +3048,38 @@ bool String::is_valid_identifier() const { //kind of poor should be rewritten properly +String String::world_wrap(int p_chars_per_line) const { + + int from=0; + int last_space=0; + String ret; + for(int i=0;i<length();i++) { + if (i-from>=p_chars_per_line) { + if (last_space==-1) { + ret+=substr(from,i-from+1)+"\n"; + from=i+1; + } else { + ret+=substr(from,last_space-from)+"\n"; + i=last_space; + from=i+1; + } + last_space=-1; + } else if (operator[](i)==' ' || operator[](i)=='\t') { + last_space=i; + } else if (operator[](i)=='\n') { + ret+=substr(from,i-from); + from=i+1; + last_space=-1; + } + } + + if (from<length()) { + ret+=substr(from,length()); + } + + return ret; +} + String String::c_unescape() const { String escaped=*this; |