in reply to Re^2: Tags in TK Text widgets
in thread Tags in TK Text widgets
One thing to do is to replace newlines with spaces in the validate sub.
sub validate_text { my $wstring = $ts_box->get("1.0", "end") =~ s/\s+/ /gr; $ts_box->delete('1.0', 'end'); $ts_box->insert('end', $wstring); $ts_box->tagAdd( 'badc', "1.$-[0]", "1.$+[0]" ) while $wstring =~ /[^A-Za-z0-9 \/.,=?*+]+/g; }
Some of the existing code has been slightly tightened up, just a little. :)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Tags in TK Text widgets
by colintu (Acolyte) on Aug 18, 2024 at 17:56 UTC |