Subject: | Tk::TextUndo undo bug |
From: | vaidas100 [...] gmail.com |
UNDO bug happens after:
1) insert text which starts with LF and ends with LF:
$my_text->insert( 'sel.first', "\nNEW TEXT\n" );
2) make undo:
$my_text->undo();
Code of bug demonstration:
---------------------------------
use Tk;
use Tk::TextUndo;
$my_window = MainWindow->new();
$my_label = $my_window->Label( -font => "Courier 40" )->pack();
$my_text = $my_window->TextUndo( -font => "Courier 40" )->pack( -expand => 1, -fill => 'both' );
$my_text->insert( 'end', "1111111111\n2222222222\n3333333333" );
$my_text->tagAdd( 'sel', '2.0', '2.end' );
$my_text->ResetUndo;
$my_text->focusForce();
$my_label->configure( -text => "After 10s\nnew text\n\"<LF>AAAAAAAAAA<LF>\"\nwould be inserted." );
$my_text->after(
10000,
sub {
$my_text->insert( 'sel.first', "\nAAAAAAAAAA\n" );
$my_text->tagRemove( 'sel', '0.0', 'end' );
$my_text->tagAdd( 'sel', '2.0', '3.end' );
$my_label->configure( -text => "After 10s\nUNDO would be done." );
}
);
$my_text->after(
20000,
sub {
$my_text->undo();
$my_label->configure( -text => "Where is \"2222222222\" line?" );
}
);
MainLoop;
---------------------------------