Skip to content

Commit

Permalink
Fix colmn offsets
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinEady committed Feb 28, 2024
1 parent 5187206 commit 48191e9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pol-core/bscript/compiler/file/PrettifyFileProcessor.cpp
Expand Up @@ -1280,7 +1280,7 @@ void PrettifyFileProcessor::preprocess( SourceFile& sf, std::optional<Range> for
{
if ( line <= rawlines.size() )
{
return rawlines[line - 1].length();
return rawlines[line - 1].length() + 1;
}
return std::numeric_limits<size_t>::max();
};
Expand All @@ -1299,16 +1299,16 @@ void PrettifyFileProcessor::preprocess( SourceFile& sf, std::optional<Range> for
if ( format_range->start.line_number > 1 )
{
format_range_skip_head =
Range( Position{ 1, 0, 0 },
Range( Position{ 1, 1, 0 },
Position{ format_range->start.line_number - 1,
column_for_line( format_range->start.line_number - 1 ), 0 } );
}

// Only create skipline foot if format range ends before last line.
if ( format_range->end.line_number < rawlines.size() - 1 )
if ( format_range->end.line_number < rawlines.size() )
{
format_range_skip_foot =
Range( Position{ format_range->end.line_number + 1, 0, 0 },
Range( Position{ format_range->end.line_number + 1, 1, 0 },
Position{ rawlines.size(), column_for_line( rawlines.size() ), 0 } );
}
}
Expand Down

0 comments on commit 48191e9

Please sign in to comment.