mirror of
https://github.com/odin-lang/Odin.git
synced 2026-08-27 07:21:31 +00:00
fix eol diagnostic
This commit is contained in:
@@ -432,8 +432,10 @@ gb_internal isize show_error_on_line(TokenPos const &pos, TokenPos end) {
|
||||
window_close_bytes = line_length_bytes;
|
||||
}
|
||||
|
||||
for (i32 i = error_start_index_graphemes; i > 0; i -= 1) {
|
||||
if (graphemes[i].byte_index == window_open_bytes) {
|
||||
// counts the graphemes before the error. It must not read the one at it: an error at the
|
||||
// end of a line indexes one past the last grapheme
|
||||
for (i32 i = error_start_index_graphemes-1; i >= 0; i -= 1) {
|
||||
if (graphemes[i].byte_index < window_open_bytes) {
|
||||
break;
|
||||
}
|
||||
squiggle_padding += graphemes[i].width;
|
||||
|
||||
@@ -113,6 +113,12 @@ gb_internal gbString get_file_line_as_string(TokenPos const &pos, i32 *offset_)
|
||||
if (len < offset) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// a column past the first cannot belong to a line the offset has already left
|
||||
if (offset > 0 && pos.column > 1 && start[offset-1] == '\n') {
|
||||
offset -= 1;
|
||||
}
|
||||
|
||||
u8 *pos_offset = start+offset;
|
||||
|
||||
u8 *line_start = pos_offset;
|
||||
|
||||
Reference in New Issue
Block a user