X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ftext%2Fcursor-helper-functions.cpp;h=2379bcc3b93aed421ad02708d16fbb472a136ac8;hb=29a52105283ce8ced672ed92545daeacf882316a;hp=7b08c47eee53e94a045ad3d5588c15a906777547;hpb=df3c676eff60f25b4fcc99603c4a07af8390e86a;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/text/cursor-helper-functions.cpp b/dali-toolkit/internal/text/cursor-helper-functions.cpp index 7b08c47..2379bcc 100644 --- a/dali-toolkit/internal/text/cursor-helper-functions.cpp +++ b/dali-toolkit/internal/text/cursor-helper-functions.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. + * Copyright (c) 2022 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -485,9 +485,9 @@ void GetCursorPosition(GetCursorPositionParameters& parameters, const GlyphInfo* const glyphInfoBuffer = parameters.visualModel->mGlyphs.Begin(); CharacterIndex index; GlyphMetrics glyphMetrics; - MetricsPtr& metrics = parameters.metrics; - GlyphIndex glyphIndex = 0u; - Length numberOfGlyphs = 0u; + MetricsPtr& metrics = parameters.metrics; + GlyphIndex glyphIndex = 0u; + Length numberOfGlyphs = 0u; if(isLastNewParagraph) { @@ -503,8 +503,12 @@ void GetCursorPosition(GetCursorPositionParameters& parameters, cursorInfo.lineHeight = GetLineHeight(newLine); + index = 0u; const Length totalNumberOfCharacters = parameters.logicalModel->mText.Count(); - index = totalNumberOfCharacters - 1; + if(totalNumberOfCharacters > 0u) + { + index = totalNumberOfCharacters - 1u; + } GetGlyphMetricsFromCharacterIndex(index, glyphInfoBuffer, charactersToGlyphBuffer, glyphsPerCharacterBuffer, metrics, glyphMetrics, glyphIndex, numberOfGlyphs);