Search code examples
textiteratorgtkvalagtk-textbuffer

Vala TextBuffer backspace() SIGSEG


In order to practice writing on Vala I decided to make a virtual keyboard. Everything works, except Backspace(SIGSEG if press).

https://developer.gnome.org/pygtk/stable/class-gtktextbuffer.html#method-gtktextbuffer--end-user-action I have not found any example of using this function in Vala. source


Solution

  • I don't know why, but it works if you replace

    Sas.end.backward_chars (Sas.input.buffer.cursor_position);
    

    with

    Sas.input.buffer.get_iter_at_offset(out Sas.end,Sas.input.buffer.cursor_position);
    

    SIGSEG was on line:

    Sas.input.buffer.backspace(Sas.end,true,true);
    

    P.S. input - TextView, end - TextIter.