That can be tough (wrapping this, wrapping that, woosh).
You should definetly add a status bar which displays current line/column.
As for the line numbers, the easy way would be to just add a read-only text widget on the left :)
something like
#
# [0001][#!/usr/bin/perl ][^]
# [0002][ ][ ]
# [0003][=head1 NAME ][ ]
# [0004][ ][ ]
# [....][...........................][ ]
#
# In pEdit version 0.7 (beta release)
# replace the
#
# my $t = $mw->Scrolled("Text", ...
#
# line with the following
my $foy = $mw->Frame->pack(
-fill => 'both',
-expand => 1,
);
my $linenumbers = $foy->ROText(
-width => 4,
-font => ['Courier New', '10'],
-background => '#c0c0c0',
)->pack(
-pady => 0,
-padx => 0,
-ipady => 0,
-ipadx => 0,
-side => 'left',
-fill=> 'y',
-expand =>0,
);#Tk::ROText
$linenumbers->insert('end', join "\n", map {sprintf "%4d", $_ } 1 .. 1
+20);
my $t = $foy->Text(
-font => ['Courier New', '10'],
)->pack(
-pady => 0,
-padx => 0,
-ipady => 0,
-ipadx => 0,
-side => 'right',
-fill => 'both',
-expand => 1,
);
my $scroll = $t->Scrollbar(
# -orient => 'vertical',
-command => sub {
my(@foo)= @_;
$t->yview(@foo);
$linenumbers->yview(@foo);
},
);
$t->configure( -yscrollcommand => [ set => $scroll ], );
$linenumbers->configure( -yscrollcommand => [ set => $scroll ], );
$scroll->pack(
-side => 'right',
-fill => 'y',
);
| MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!" | | I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README). | | ** The third rule of perl club is a statement of fact: pod is sexy. |
| [reply] [d/l] |
Yeah I want to code a status bar too to show the current line and character number that the cursor is at but am having a difficult time discovering how to tell what line and character number the cursor is at.
Edit:
Yes something like that. It would need to scroll with the main Text widget though and increase the more lines put in and decrease with lines taken away. It is a good start though.
I was just reading the Scrollbar.pm too trying to get an idea on how to tell where the cursor is and how the module does it. It uses some subroutines called "ScrlByUnits" to move it and I assume it tracks it also. Maybe I can use these subs to report back their results or mimic them in my script.
| [reply] |
Remember how I mentioned gedi? Just see what gedi does ...
see $text->index(index) and THE INSERTION CURSOR parts of the Tk::Text documentation.
| MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!" | | I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README). | | ** The third rule of perl club is a statement of fact: pod is sexy. |
| [reply] [d/l] |