kaile
July 26, 2023, 8:45am
1
Hi guys,
I have a sourceview widget and I would like to iterate over the lines rather than get_source_buffer(). Could not find any applicable material so I wanted to ask on your expertise if there is a nice way to do it ?
Current status ;
RefPtr<Gsv::Buffer> buf = source_view.get_source_buffer () ;
cout << buf->get_text() << std::endl;
std::string test = buf->get_text();
I am on GTK3 with gtksourceviewmm 3,
dboles
July 26, 2023, 9:34am
2
Use the buffer and investigate its functions returning iterators, moving by lines, etc. You should be able to do something like:
for (auto it = buffer->begin(), end = buffer->end(); it != end; it.forward_line()) {
// it points to the start of line N, so use it
}
1 Like
kaile
July 26, 2023, 3:02pm
3
Thank you, it’s efficiently working!
1 Like
system
(system)
Closed
August 25, 2023, 3:02pm
4
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.