Fix output log text ranges to handle line ending

This commit is contained in:
Wojtek Figat
2023-05-17 12:23:01 +02:00
parent e045f096a9
commit b244ffedd2
2 changed files with 8 additions and 8 deletions

View File

@@ -541,7 +541,7 @@ namespace FlaxEditor.Windows
{ {
ref var line = ref lines[j]; ref var line = ref lines[j];
textBlock.Range.StartIndex = startIndex + line.FirstCharIndex; textBlock.Range.StartIndex = startIndex + line.FirstCharIndex;
textBlock.Range.EndIndex = startIndex + line.LastCharIndex; textBlock.Range.EndIndex = startIndex + line.LastCharIndex + 1;
textBlock.Bounds = new Rectangle(new Float2(0.0f, prevBlockBottom), line.Size); textBlock.Bounds = new Rectangle(new Float2(0.0f, prevBlockBottom), line.Size);
if (textBlock.Range.Length > 0) if (textBlock.Range.Length > 0)
@@ -550,7 +550,7 @@ namespace FlaxEditor.Windows
var regexStart = line.FirstCharIndex; var regexStart = line.FirstCharIndex;
if (j == 0) if (j == 0)
regexStart += prefixLength; regexStart += prefixLength;
var regexLength = line.LastCharIndex - regexStart; var regexLength = line.LastCharIndex + 1 - regexStart;
if (regexLength > 0) if (regexLength > 0)
{ {
var match = _compileRegex.Match(entryText, regexStart, regexLength); var match = _compileRegex.Match(entryText, regexStart, regexLength);

View File

@@ -17,17 +17,17 @@ class FontAsset;
/// <summary> /// <summary>
/// The text range. /// The text range.
/// </summary> /// </summary>
API_STRUCT() struct TextRange API_STRUCT(NoDefault) struct TextRange
{ {
DECLARE_SCRIPTING_TYPE_MINIMAL(TextRange); DECLARE_SCRIPTING_TYPE_MINIMAL(TextRange);
/// <summary> /// <summary>
/// The start index. /// The start index (inclusive).
/// </summary> /// </summary>
API_FIELD() int32 StartIndex; API_FIELD() int32 StartIndex;
/// <summary> /// <summary>
/// The end index. /// The end index (exclusive).
/// </summary> /// </summary>
API_FIELD() int32 EndIndex; API_FIELD() int32 EndIndex;
@@ -70,7 +70,7 @@ DECLARE_SCRIPTING_TYPE_MINIMAL(TextRange);
/// <summary> /// <summary>
/// Gets the substring from the source text. /// Gets the substring from the source text.
/// </summary> /// </summary>
/// <param name="other">The text.</param> /// <param name="text">The text.</param>
/// <returns>The substring of the original text of the defined range.</returns> /// <returns>The substring of the original text of the defined range.</returns>
StringView Substring(const StringView& text) const StringView Substring(const StringView& text) const
{ {
@@ -87,7 +87,7 @@ struct TIsPODType<TextRange>
/// <summary> /// <summary>
/// The font line info generated during text processing. /// The font line info generated during text processing.
/// </summary> /// </summary>
API_STRUCT() struct FontLineCache API_STRUCT(NoDefault) struct FontLineCache
{ {
DECLARE_SCRIPTING_TYPE_MINIMAL(FontLineCache); DECLARE_SCRIPTING_TYPE_MINIMAL(FontLineCache);
@@ -151,7 +151,7 @@ struct TIsPODType<FontLineCache>
/// <summary> /// <summary>
/// The cached font character entry (read for rendering and further processing). /// The cached font character entry (read for rendering and further processing).
/// </summary> /// </summary>
API_STRUCT() struct FontCharacterEntry API_STRUCT(NoDefault) struct FontCharacterEntry
{ {
DECLARE_SCRIPTING_TYPE_MINIMAL(FontCharacterEntry); DECLARE_SCRIPTING_TYPE_MINIMAL(FontCharacterEntry);