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.

bug

code:

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

fn main() {
    // Create a new application
    let app = Application::builder()
        .application_id("org.gtk-rs.example")
        .build();

    // Connect to "activate" signal of `app`
    app.connect_activate(build_ui);

    // Run the application
    app.run();
}

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

    //impl Textfield
    let textfield = TextView::new();
    window.set_child(Some(&textfield));

    //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()
        .scale(2.0)
        .build();

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

    window.present();
}

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