summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.travis.yml1
-rw-r--r--platform/windows/detect.py2
-rw-r--r--scene/gui/line_edit.cpp4
-rw-r--r--scene/gui/text_edit.cpp33
-rw-r--r--scene/gui/text_edit.h2
5 files changed, 23 insertions, 19 deletions
diff --git a/.travis.yml b/.travis.yml
index 2c4eda9105..e10497ad7c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -55,6 +55,7 @@ addons:
- libssl-dev
- libxinerama-dev
- libxrandr-dev
+ - libxi-dev
# For cross-compiling to Windows.
#- binutils-mingw-w64-i686
diff --git a/platform/windows/detect.py b/platform/windows/detect.py
index 890decf962..d85e1b061c 100644
--- a/platform/windows/detect.py
+++ b/platform/windows/detect.py
@@ -270,7 +270,7 @@ def configure(env):
env.Append(CCFLAGS=['-DOPENGL_ENABLED'])
env.Append(CCFLAGS=['-DRTAUDIO_ENABLED'])
env.Append(CCFLAGS=['-DWASAPI_ENABLED'])
- env.Append(CCFLAGS=['-DWINVER=%s' % winver, '-D_WIN32_WINNT=%s' % winver])
+ env.Append(CCFLAGS=['-DWINVER=%s' % env['target_win_version'], '-D_WIN32_WINNT=%s' % env['target_win_version']])
env.Append(LIBS=['mingw32', 'opengl32', 'dsound', 'ole32', 'd3d9', 'winmm', 'gdi32', 'iphlpapi', 'shlwapi', 'wsock32', 'ws2_32', 'kernel32', 'oleaut32', 'dinput8', 'dxguid', 'ksuser'])
env.Append(CPPFLAGS=['-DMINGW_ENABLED'])
diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp
index f7bf1cd9ea..85ae6d6241 100644
--- a/scene/gui/line_edit.cpp
+++ b/scene/gui/line_edit.cpp
@@ -1046,6 +1046,10 @@ void LineEdit::set_cursor_position(int p_pos) {
} else if (cursor_pos > window_pos) {
/* Adjust window if cursor goes too much to the right */
int window_width = get_size().width - style->get_minimum_size().width;
+ if (has_icon("right_icon")) {
+ Ref<Texture> r_icon = Control::get_icon("right_icon");
+ window_width -= r_icon->get_width();
+ }
if (window_width < 0)
return;
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 396186d487..2f041f4fb9 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -4507,16 +4507,17 @@ int TextEdit::num_lines_from(int p_line_from, int unhidden_amount) const {
return num_total;
}
-int TextEdit::get_whitespace_level(int p_line) const {
+int TextEdit::get_indent_level(int p_line) const {
ERR_FAIL_INDEX_V(p_line, text.size(), 0);
// counts number of tabs and spaces before line starts
+ int tab_count = 0;
int whitespace_count = 0;
int line_length = text[p_line].size();
for (int i = 0; i < line_length - 1; i++) {
if (text[p_line][i] == '\t') {
- whitespace_count++;
+ tab_count++;
} else if (text[p_line][i] == ' ') {
whitespace_count++;
} else if (text[p_line][i] == '#') {
@@ -4525,7 +4526,7 @@ int TextEdit::get_whitespace_level(int p_line) const {
break;
}
}
- return whitespace_count;
+ return tab_count + whitespace_count / indent_size;
}
bool TextEdit::can_fold(int p_line) const {
@@ -4542,12 +4543,12 @@ bool TextEdit::can_fold(int p_line) const {
if (is_line_hidden(p_line))
return false;
- int start_indent = get_whitespace_level(p_line);
+ int start_indent = get_indent_level(p_line);
for (int i = p_line + 1; i < text.size(); i++) {
if (text[i].size() == 0)
continue;
- int next_indent = get_whitespace_level(i);
+ int next_indent = get_indent_level(i);
if (next_indent > start_indent)
return true;
else
@@ -4576,22 +4577,20 @@ void TextEdit::fold_line(int p_line) {
return;
// hide lines below this one
- int start_indent = get_whitespace_level(p_line);
+ int start_indent = get_indent_level(p_line);
+ int last_line = start_indent;
for (int i = p_line + 1; i < text.size(); i++) {
- int cur_indent = get_whitespace_level(i);
- if (text[i].size() == 0 || cur_indent > start_indent) {
- set_line_as_hidden(i, true);
- } else {
- // exclude trailing empty lines
- for (int trail_i = i - 1; trail_i > p_line; trail_i--) {
- if (text[trail_i].size() == 0)
- set_line_as_hidden(trail_i, false);
- else
- break;
+ if (text[i].strip_edges().size() != 0) {
+ if (get_indent_level(i) > start_indent) {
+ last_line = i;
+ } else {
+ break;
}
- break;
}
}
+ for (int i = p_line + 1; i <= last_line; i++) {
+ set_line_as_hidden(i, true);
+ }
// fix selection
if (is_selection_active()) {
diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h
index 428c850a1b..1bbca22cb1 100644
--- a/scene/gui/text_edit.h
+++ b/scene/gui/text_edit.h
@@ -431,7 +431,6 @@ public:
void fold_all_lines();
void unhide_all_lines();
int num_lines_from(int p_line_from, int unhidden_amount) const;
- int get_whitespace_level(int p_line) const;
bool can_fold(int p_line) const;
bool is_folded(int p_line) const;
void fold_line(int p_line);
@@ -444,6 +443,7 @@ public:
void indent_selection_left();
void indent_selection_right();
+ int get_indent_level(int p_line) const;
inline void set_scroll_pass_end_of_file(bool p_enabled) {
scroll_past_end_of_file_enabled = p_enabled;