Przeglądaj źródła

Fixing caret down movement

Marko Pintera 12 lat temu
rodzic
commit
00cfa7808c
1 zmienionych plików z 7 dodań i 0 usunięć
  1. 7 0
      BansheeEngine/Source/BsGUIInputCaret.cpp

+ 7 - 0
BansheeEngine/Source/BsGUIInputCaret.cpp

@@ -89,6 +89,13 @@ namespace BansheeEngine
 			charIdx -= 1;	
 			charIdx -= 1;	
 
 
 		UINT32 lineIdx = mTextSprite->getLineForChar(charIdx);
 		UINT32 lineIdx = mTextSprite->getLineForChar(charIdx);
+		const SpriteLineDesc& desc = mTextSprite->getLineDesc(lineIdx);
+		if(lineIdx != (mTextSprite->getNumLines() - 1)) // If not the last line
+		{
+			if(charIdx == (desc.endChar - 1)) // If char is a newline, I want that to count as being on the next line because that's
+				lineIdx++;					  // how user sees it
+		}
+
 		if(lineIdx == (mTextSprite->getNumLines() - 1))
 		if(lineIdx == (mTextSprite->getNumLines() - 1))
 			return;
 			return;