I'm writing a function to parse MSVC errors.
If I paste the MSVC output into a text file and open it in 4ed, the following function will jump to the first error. However, the function does not work when the MSVC output is in the actual *compilation* buffer. Thoughts?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | CUSTOM_COMMAND_SIG(next_error){
View_Summary view = app->get_active_view(app);
Buffer_Summary buffer = app->get_buffer(app, view.buffer_id);
Range range;
range.min = 0;
range.max = buffer.size;
String string;
string.str = (char *)app->memory;
string.size = range.max - range.min;
app->buffer_read_range(app, &buffer, range.min, range.max, string.str);
char delim_raw[16] = ") : "; //All the errors have this substring
String delim = make_string(delim_raw, 4);
int pos = find_substr(string, 0, delim);
Buffer_Seek seek = {};
seek.pos = pos;
app->view_set_cursor(app, &view, seek, 0);
}
|