← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~widelands-dev/widelands/bug-1571308-editbox_crash into lp:widelands

 

Miroslav Remák has proposed merging lp:~widelands-dev/widelands/bug-1571308-editbox_crash into lp:widelands.

Commit message:
Fix height and text displacement issues in EditBox

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #1571308 in widelands: "Crash when EditBox text exceeds maximum width"
  https://bugs.launchpad.net/widelands/+bug/1571308

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/bug-1571308-editbox_crash/+merge/292591
-- 
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/bug-1571308-editbox_crash into lp:widelands.
=== modified file 'src/ui_basic/editbox.cc'
--- src/ui_basic/editbox.cc	2016-04-05 14:42:33 +0000
+++ src/ui_basic/editbox.cc	2016-04-21 23:29:07 +0000
@@ -76,8 +76,8 @@
 	 const Image* background,
 	 int font_size)
 	:
-	Panel(parent, x, y, w, UI::g_fh1->render(as_uifont(UI::g_fh1->fontset()->representative_character()),
-														  font_size)->height() + 2),
+	Panel(parent, x, y, w, UI::g_fh1->render(as_editorfont(UI::g_fh1->fontset()->representative_character(),
+														  font_size))->height() + 4),
 	m_(new EditBoxImpl),
 	history_active_(false),
 	history_position_(-1)
@@ -428,11 +428,11 @@
 				// TODO(GunChleoc): Arabic: Fix scrolloffset
 				dst.blitrect(point,
 								 entry_text_im,
-								 Rect(point.x + m_->scrolloffset + kMargin, point.y, max_width, lineheight));
+								 Rect(point.x + m_->scrolloffset + kMargin, 0, max_width, lineheight));
 			} else {
 				dst.blitrect(point,
 								 entry_text_im,
-								 Rect(point.x - m_->scrolloffset - kMargin, point.y, max_width, lineheight));
+								 Rect(-m_->scrolloffset, 0, max_width, lineheight));
 			}
 		}
 	} else {


Follow ups