in reply to A little edit decision list in Perl

I'm biased toward Tk. I probably would have made 2 side by side text boxes and just cut'n'paste. The mouse would make it easier to cut in a mid-line position.Something like this (it even has built-in ctrl-c and ctrl-v key bindings)
#!/usr/bin/perl use Tk; use Tk::TextUndo; use Tk::Adjuster; use strict; my $file = shift || $0; my $buf; open (FH,"< $file"); read( FH, $buf, -s FH ); close FH; my $mw = tkinit(-title=>'Some Title'); my $TextTOP = $mw->Scrolled("TextUndo")->pack(-expand=>1, -fill=>'both +'); my $adj = $mw->Adjuster->packAfter($TextTOP); my $TextBOTTOM = $mw->Scrolled("Text")->pack(-expand=>1, -fill =>'both +'), $mw->bind('<Control-s>', sub { print "saving...\n" }); $mw->bind('Tk::Text', '<Control-s>', \&save_file); $mw->Button(-text=>'Exit', -command=> sub{Tk::exit})->pack(); $TextTOP->insert('end',"$buf"); MainLoop; sub save_file{ open(FH,">> $0.txt") or warn "$!\n"; my $current_text = $TextBOTTOM->get('1.0', 'end'); print FH $current_text,"\n"; close FH; }

I'm not really a human, but I play one on earth. flash japh

Replies are listed 'Best First'.
Re^2: A little edit decision list in Perl
by brian_d_foy (Abbot) on Sep 30, 2004 at 17:22 UTC
    Why use Tk at all? Just open two text editor windows and do the same thing if that's what you want to do. Programming is supposed to save you time. ;)
    --
    brian d foy <bdfoy@cpan.org>