Strange behaviour of tags and TextView

I have noticed some strange behaviour in an editable TextView with lines with different tags. Now I am asking me if this is should be this way and why or if this is due to my code or if this is a bug.
Thank you very much if you now a solution.



use gtk::prelude::*;
use gtk::{Application, ApplicationWindow, Button, TextTag, TextView};
use pango;

fn main() {
    // Create a new application
    let app = Application::builder()

    // Connect to "activate" signal of `app`

    // Run the application;

fn build_ui(app: &Application) {
    // Create a window and set the title
    let window = ApplicationWindow::builder()
        .title("My GTK App")

    //impl Textfield
    let textfield = TextView::new();

    //impl buffer with text
    let buffer = textfield.buffer();
    buffer.set_text("This is the first line\nand this is the second\nthird line\n");

    //Create firsttag
    let firsttag = TextTag::builder()

    //Apply firsttag
    let firstiter = buffer.start_iter();
    let mut seconditer = firstiter.clone();
    let _ = seconditer.forward_line();
    buffer.apply_tag(&firsttag, &firstiter, &seconditer);


This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.