Many thanks for your concerned handling of this case and for the time spent. My version of Perl is v5.10.1 (*) built for x86_64-linux-gnu-thread-multi (with 53 registered patches) and Tk installed (by Cpan I think) under /usr/local/lib/perl/5.10.1/Tk.pm seems to be Tk804.029 (as displayed by 'man Tk').

I've run your tests and the results reported below are quite puzzling to me. I won't create another mini example because I think yours is perfectly demonstrative of my problem. Apart from the fact that I still don't know how to solve it I find some ease in not having disturbed you for mere carelessness.

My results for the keypress of <control-s>:

test 4 (the original behaviour of your program):
"main control s\n" is printed to the console when the focus is $mw.
"\t\tfoo\n" is printed in the in the console and "\x{13}" in the text widget when the insertion point is in.

test 3 uncommented (other tests commented out):
"main control s\n" is printed to the console when the focus is $mw.
"\t\tfoo\n" is printed in the in the console and "\x{13}" in the text widget when the insertion point is in.
Behaves as test 4.

test 2 uncommented (other tests commented out):
"main control s\n" is printed to the console when the focus is $mw.
"\ttext control s\nmain control s\n" is printed in the in the console and "\x{13}" in the text widget when the insertion point is in.

test 1 (each test commented out):
"main control s\n" is printed to the console when the focus is $mw.
"main control s\n" is printed in the in the console and "\x{13}" in the text widget when the insertion point is in.

Comment:
If it wouldn't be for test4 which differs deeply, I would think that your newline is replaced by \x{13} in my Tk version. But why should a newline be printed anyway?


In reply to Re^2: Tk hidden binding by emilbarton
in thread Tk hidden binding by emilbarton

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.