|
|
|
@ -1001,6 +1001,8 @@ void Source::View::setup_format_style(bool is_generic_view) { |
|
|
|
{ |
|
|
|
{ |
|
|
|
LockGuard lock(mutex); |
|
|
|
LockGuard lock(mutex); |
|
|
|
if(result) { |
|
|
|
if(result) { |
|
|
|
|
|
|
|
if(!result->text.empty() && result->text.back() != '\n') // Workaround for prettier-plugin-latex that has missing newline at end of file
|
|
|
|
|
|
|
|
result->text += '\n'; |
|
|
|
replace_text(result->text); |
|
|
|
replace_text(result->text); |
|
|
|
if(result->cursor_offset >= 0 && result->cursor_offset < get_buffer()->size()) { |
|
|
|
if(result->cursor_offset >= 0 && result->cursor_offset < get_buffer()->size()) { |
|
|
|
get_buffer()->place_cursor(get_buffer()->get_iter_at_offset(result->cursor_offset)); |
|
|
|
get_buffer()->place_cursor(get_buffer()->get_iter_at_offset(result->cursor_offset)); |
|
|
|
@ -1047,7 +1049,10 @@ void Source::View::setup_format_style(bool is_generic_view) { |
|
|
|
std::stringstream stdin_stream(get_buffer()->get_text().raw()), stdout_stream, stderr_stream; |
|
|
|
std::stringstream stdin_stream(get_buffer()->get_text().raw()), stdout_stream, stderr_stream; |
|
|
|
auto exit_status = Terminal::get().process(stdin_stream, stdout_stream, command, this->file_path.parent_path(), &stderr_stream); |
|
|
|
auto exit_status = Terminal::get().process(stdin_stream, stdout_stream, command, this->file_path.parent_path(), &stderr_stream); |
|
|
|
if(exit_status == 0) { |
|
|
|
if(exit_status == 0) { |
|
|
|
replace_text(stdout_stream.str()); |
|
|
|
auto text = stdout_stream.str(); |
|
|
|
|
|
|
|
if(!text.empty() && text.back() != '\n') // Workaround for prettier-plugin-latex that has missing newline at end of file
|
|
|
|
|
|
|
|
text += '\n'; |
|
|
|
|
|
|
|
replace_text(text); |
|
|
|
std::string line; |
|
|
|
std::string line; |
|
|
|
std::getline(stderr_stream, line); |
|
|
|
std::getline(stderr_stream, line); |
|
|
|
if(!line.empty() && line != "NaN") { |
|
|
|
if(!line.empty() && line != "NaN") { |
|
|
|
|