/[svn]/gigedit/trunk/src/gigedit/scripteditor.cpp
ViewVC logotype

Diff of /gigedit/trunk/src/gigedit/scripteditor.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3158 by schoenebeck, Mon May 8 18:05:35 2017 UTC revision 3206 by schoenebeck, Thu May 25 10:50:08 2017 UTC
# Line 339  LinuxSampler::ScriptVM* ScriptEditor::Ge Line 339  LinuxSampler::ScriptVM* ScriptEditor::Ge
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(
# Line 350  static void getIteratorsForIssue(Glib::R Line 357  static void getIteratorsForIssue(Glib::R
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);

Legend:
Removed from v.3158  
changed lines
  Added in v.3206

  ViewVC Help
Powered by ViewVC