339 |
} |
} |
340 |
|
|
341 |
static void getIteratorsForIssue(Glib::RefPtr<Gtk::TextBuffer>& txtbuf, const LinuxSampler::ParserIssue& issue, Gtk::TextBuffer::iterator& start, Gtk::TextBuffer::iterator& end) { |
static void getIteratorsForIssue(Glib::RefPtr<Gtk::TextBuffer>& txtbuf, const LinuxSampler::ParserIssue& issue, Gtk::TextBuffer::iterator& start, Gtk::TextBuffer::iterator& end) { |
342 |
start = txtbuf->get_iter_at_line_index(issue.firstLine - 1, issue.firstColumn - 1); |
Gtk::TextBuffer::iterator itLine = |
343 |
|
txtbuf->get_iter_at_line_index(issue.firstLine - 1, 0); |
344 |
|
const int charsInLine = itLine.get_bytes_in_line(); |
345 |
|
start = txtbuf->get_iter_at_line_index( |
346 |
|
issue.firstLine - 1, |
347 |
|
// check we are not getting past the end of the line here, otherwise Gtk crashes |
348 |
|
issue.firstColumn - 1 < charsInLine ? issue.firstColumn - 1 : charsInLine - 1 |
349 |
|
); |
350 |
end = start; |
end = start; |
351 |
end.forward_lines(issue.lastLine - issue.firstLine); |
end.forward_lines(issue.lastLine - issue.firstLine); |
352 |
end.forward_chars( |
end.forward_chars( |
357 |
} |
} |
358 |
|
|
359 |
static void applyCodeTag(Glib::RefPtr<Gtk::TextBuffer>& txtbuf, const LinuxSampler::VMSourceToken& token, Glib::RefPtr<Gtk::TextBuffer::Tag>& tag) { |
static void applyCodeTag(Glib::RefPtr<Gtk::TextBuffer>& txtbuf, const LinuxSampler::VMSourceToken& token, Glib::RefPtr<Gtk::TextBuffer::Tag>& tag) { |
360 |
Gtk::TextBuffer::iterator itStart = |
Gtk::TextBuffer::iterator itLine = |
361 |
txtbuf->get_iter_at_line_index(token.firstLine(), token.firstColumn()); |
txtbuf->get_iter_at_line_index(token.firstLine(), 0); |
362 |
|
const int charsInLine = itLine.get_bytes_in_line(); |
363 |
|
Gtk::TextBuffer::iterator itStart = txtbuf->get_iter_at_line_index( |
364 |
|
token.firstLine(), |
365 |
|
// check we are not getting past the end of the line here, otherwise Gtk crashes |
366 |
|
token.firstColumn() < charsInLine ? token.firstColumn() : charsInLine - 1 |
367 |
|
); |
368 |
Gtk::TextBuffer::iterator itEnd = itStart; |
Gtk::TextBuffer::iterator itEnd = itStart; |
369 |
const int length = token.text().length(); |
const int length = token.text().length(); |
370 |
itEnd.forward_chars(length); |
itEnd.forward_chars(length); |