I have issues with this function. The documentation says:
$text->see(index) Adjusts the view in the window so that the character given by index is completely visible. If index is already visible then the command does nothing. If index is a short distance out of view, the command adjusts the view just enough to make index visible at the edge of the window. If index is far out of view, then the command centers index in the window.
To me this means if the "index" is slightly to the top of the visible screen it will move the "index" position to the top edge of the widget window. If the "index" is slightlly off the screen to the bottom of the widget window it will position the "index" at the bottom edge of the window.

However when I use this function it seems to want a value in the form of x.x (line.character). I give it this value and it runs fine but when this value gets to be 2.0 the scroll fucntion jumps to the very last line (in this case 950).

Why is this?

Here is the subroutine in question:

sub line_num { my $total_lines = shift; my $line_number = ($t->index('insert')); print $line_number,"\n"; $linenumbers->delete("1.0", "end"); for (0..$total_lines) { $linenumbers->insert('end', join "\n", map {sprintf "%4d", $_ } +$_); } #$linenumbers->yviewMoveto($line_number/$total_lines); #$linenumbers->yview(-pickplace, $line_number); $linenumbers->see($line_number); }

In reply to Valid values of Tk::Text see() function. by Anonymous Monk

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.