瀏覽代碼

Merge pull request #5394 from Laserlicht/fixes

[1.6.6] Multiple fixes
Ivan Savenko 8 月之前
父節點
當前提交
51c71bb839
共有 3 個文件被更改,包括 8 次插入3 次删除
  1. 3 1
      client/eventsSDL/InputSourceTouch.cpp
  2. 1 1
      client/lobby/SelectionTab.cpp
  3. 4 1
      lib/texts/TextOperations.cpp

+ 3 - 1
client/eventsSDL/InputSourceTouch.cpp

@@ -20,6 +20,7 @@
 #include "../gui/EventDispatcher.h"
 #include "../gui/MouseButton.h"
 #include "../gui/WindowHandler.h"
+#include "../render/IScreenHandler.h"
 #include "../CServerHandler.h"
 #include "../globalLobby/GlobalLobbyClient.h"
 
@@ -65,6 +66,7 @@ void InputSourceTouch::handleEventFingerMotion(const SDL_TouchFingerEvent & tfin
 		case TouchState::RELATIVE_MODE:
 		{
 			Point screenSize = GH.screenDimensions();
+			int scalingFactor = GH.screenHandler().getScalingFactor();
 
 			Point moveDistance {
 				static_cast<int>(screenSize.x * params.relativeModeSpeedFactor * tfinger.dx),
@@ -73,7 +75,7 @@ void InputSourceTouch::handleEventFingerMotion(const SDL_TouchFingerEvent & tfin
 
 			GH.input().moveCursorPosition(moveDistance);
 			if (CCS && CCS->curh)
-				CCS->curh->cursorMove(GH.getCursorPosition().x, GH.getCursorPosition().y);
+				CCS->curh->cursorMove(GH.getCursorPosition().x * scalingFactor, GH.getCursorPosition().y * scalingFactor);
 
 			break;
 		}

+ 1 - 1
client/lobby/SelectionTab.cpp

@@ -457,7 +457,7 @@ void SelectionTab::showPopupWindow(const Point & cursorPosition)
 		}
 
 		GH.windows().createAndPushWindow<CMapOverview>(
-			curItems[py]->getNameTranslated(),
+			curItems[py]->name,
 			curItems[py]->fullFileURI,
 			creationDateTime,
 			author,

+ 4 - 1
lib/texts/TextOperations.cpp

@@ -307,7 +307,10 @@ bool TextOperations::textSearchSimilar(const std::string & s, const std::string
 	if(boost::algorithm::contains(haystack, needle))
 		return true;
 
-	for(int i = 0; i < haystack.size() - needle.size(); i++)
+	if(needle.size() > haystack.size())
+		return false;
+
+	for(int i = 0; i < haystack.size() - needle.size() + 1; i++)
 	{
 		auto dist = getLevenshteinDistance(haystack.substr(i, needle.size()), needle);
 		if(needle.size() > 2 && dist <= 1)