A fix for snippet formatting
This commit is contained in:
parent
69761c8e8a
commit
f87308f8fe
@ -144,12 +144,21 @@ namespace cpptrace {
|
||||
continue;
|
||||
}
|
||||
print_frame_internal(stream, frame, color, frame_number_width, counter);
|
||||
if(frame.line.has_value() && !frame.filename.empty() && options.snippets) {
|
||||
auto snippet = detail::get_snippet(
|
||||
frame.filename,
|
||||
frame.line.value(),
|
||||
options.context_lines,
|
||||
color
|
||||
);
|
||||
if(!snippet.empty()) {
|
||||
stream << '\n';
|
||||
stream << snippet;
|
||||
}
|
||||
}
|
||||
if(newline_at_end || &frame != &frames.back()) {
|
||||
stream << '\n';
|
||||
}
|
||||
if(frame.line.has_value() && !frame.filename.empty() && options.snippets) {
|
||||
stream << detail::get_snippet(frame.filename, frame.line.value(), options.context_lines, color);
|
||||
}
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -135,7 +135,10 @@ namespace detail {
|
||||
if(color && line == target_line) {
|
||||
snippet += RESET;
|
||||
}
|
||||
snippet += lines[line - original_begin] + "\n";
|
||||
snippet += lines[line - original_begin];
|
||||
if(line != end) {
|
||||
snippet += '\n';
|
||||
}
|
||||
}
|
||||
return snippet;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user