summaryrefslogtreecommitdiff
path: root/scene/gui
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2018-05-16 02:32:40 +0200
committerGitHub <noreply@github.com>2018-05-16 02:32:40 +0200
commit6f4a90592fa2f8142fa34871a564f012a034bc75 (patch)
tree0feeb83aa2e36ed7f5dd3c6c47336704b62937ad /scene/gui
parentdfee637ff99a949ead64a4710d4526c164886577 (diff)
parentce434bca825b2ffc5c5fe3f7884ca21d863ddbf8 (diff)
Merge pull request #18909 from ianb96/getcharwidthfix
fix get_char_width for non-latin characters
Diffstat (limited to 'scene/gui')
-rw-r--r--scene/gui/text_edit.cpp4
-rw-r--r--scene/gui/text_edit.h2
2 files changed, 3 insertions, 3 deletions
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 553c2b7c39..34365d0123 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -302,7 +302,7 @@ void TextEdit::Text::remove(int p_at) {
text.remove(p_at);
}
-int TextEdit::Text::get_char_width(char c, char next_c, int px) const {
+int TextEdit::Text::get_char_width(CharType c, CharType next_c, int px) const {
int tab_w = font->get_char_size(' ').width * indent_size;
int w = 0;
@@ -3620,7 +3620,7 @@ void TextEdit::adjust_viewport_to_cursor() {
visible_width -= v_scroll->get_combined_minimum_size().width;
visible_width -= 20; // give it a little more space
- if (is_wrap_enabled()) {
+ if (!is_wrap_enabled()) {
// adjust x offset
int cursor_x = get_column_x_offset(cursor.column, text[cursor.line]);
diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h
index 6f4eb01a70..5c82d1ac20 100644
--- a/scene/gui/text_edit.h
+++ b/scene/gui/text_edit.h
@@ -95,7 +95,7 @@ public:
void set_color_regions(const Vector<ColorRegion> *p_regions) { color_regions = p_regions; }
int get_line_width(int p_line) const;
int get_max_width(bool p_exclude_hidden = false) const;
- int get_char_width(char c, char next_c, int px) const;
+ int get_char_width(CharType c, CharType next_c, int px) const;
void set_line_wrap_amount(int p_line, int p_wrap_amount) const;
int get_line_wrap_amount(int p_line) const;
const Map<int, ColorRegionInfo> &get_color_region_info(int p_line) const;