Преглед на файлове

Merge pull request #658 from ShubusCorporation/shc_test_centered

Fix: Issue #3151 - text centralization
Alexander Shishkin преди 5 години
родител
ревизия
ff7fd2077a
променени са 1 файла, в които са добавени 3 реда и са изтрити 1 реда
  1. 3 1
      client/widgets/TextControls.cpp

+ 3 - 1
client/widgets/TextControls.cpp

@@ -367,8 +367,10 @@ CGStatusBar::CGStatusBar(int x, int y, std::string name, int maxw)
 	OBJECT_CONSTRUCTION_CAPTURING(255-DISPOSE);
 	background = std::make_shared<CPicture>(name);
 	pos = background->pos;
-	if(maxw < pos.w)
+
+	if((unsigned)maxw < (unsigned)pos.w) //(insigned)-1 > than any correct value of pos.w
 	{
+		//execution of this block when maxw is incorrect breaks text centralization (issue #3151)
 		vstd::amin(pos.w, maxw);
 		background->srcRect = new Rect(0, 0, maxw, pos.h);
 	}