Click here to get back home

RFC + sanity check, Tk::Text with Vi interface

 HomeNewsGroups | Search | About
 comp.lang.perl.modules    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
RFC + sanity check, Tk::Text with Vi interface j-strom 04-18-2008
Posted by j-strom on April 18, 2008, 7:29 pm
Please log in for more thread options
I've been pulling together a module that acts as a replacement for
Tk::Text but handles keyboard input similar to Vi (originally to stop
me from sticking "dd" all over my config files, but it seems like one
of those things silly enough that others might get some use out of
it). This is the first time I've tried something like this, so I'd
appreciate any suggestions or corrections. Is Tk::TextVi a reasonable
name? Does my interface have any serious flaws? Am I missing and
features that have to be there? etc.

A few excerpts from the POD is below or the full archive can be found
here: http://omega0.xepher.net/stuff/Tk-TextVi-0.01.tar.gz

use Tk::TextVi;
$textvi = $window->TextVi( -option => value, ... );

Tk::TextVi is a Tk::Text widget that replaces InsertKeypress() to
handle user input similar to vi. All other methods remain the same
(and most code should be using $text->insert( ... ) rather than $text-
>InsertKeypress()). This only implements the text widget and key
press logic; the status bar must be drawn by the application (see
TextViDemo.pl for an example of this).

Functions in Vi that require interaction with the system (such as
reading or writing files) are not (currently) handled by this module
(This is a feature since you probably don't want :quit to do exactly
that).

OPTIONS

-statuscommand

Callback invoked when the mode or the keys in the pending command
change. The current mode and pending keys will be passed to this
function.

-messagecommand

Callback invoked when messages need to be displayed.

-systemcommand

Callback invoked when the parent application needs to take action. If
you return 'undef' the widget will pretend that command doesn't exist
and do nothing. Currently, the argument can be:

'quit' The :quit command has been entered

SUPPORTED COMMANDS
Normal: a d f ga gg h i j k l m n o p q r t v x y D G O V 0 @ ` $ % /
Command: :quit :nohlsearch :split :map


Posted by smallpond on April 25, 2008, 12:45 pm
Please log in for more thread options
On Apr 18, 7:29 pm, j-st...@verizon.net wrote:
> I've been pulling together a module that acts as a replacement for
> Tk::Text but handles keyboard input similar to Vi (originally to stop
> me from sticking "dd" all over my config files, but it seems like one
> of those things silly enough that others might get some use out of
> it). This is the first time I've tried something like this, so I'd
> appreciate any suggestions or corrections. Is Tk::TextVi a reasonable
> name? Does my interface have any serious flaws? Am I missing and
> features that have to be there? etc.
>
> A few excerpts from the POD is below or the full archive can be found
> here:http://omega0.xepher.net/stuff/Tk-TextVi-0.01.tar.gz
>
> use Tk::TextVi;
> $textvi = $window->TextVi( -option => value, ... );
>
> Tk::TextVi is a Tk::Text widget that replaces InsertKeypress() to
> handle user input similar to vi. All other methods remain the same
> (and most code should be using $text->insert( ... ) rather than
$text->InsertKeypress()). This only implements the text widget and key
>
> press logic; the status bar must be drawn by the application (see
> TextViDemo.pl for an example of this).
>
> Functions in Vi that require interaction with the system (such as
> reading or writing files) are not (currently) handled by this module
> (This is a feature since you probably don't want :quit to do exactly
> that).
>
> OPTIONS
>
> -statuscommand
>
> Callback invoked when the mode or the keys in the pending command
> change. The current mode and pending keys will be passed to this
> function.
>
> -messagecommand
>
> Callback invoked when messages need to be displayed.
>
> -systemcommand
>
> Callback invoked when the parent application needs to take action. If
> you return 'undef' the widget will pretend that command doesn't exist
> and do nothing. Currently, the argument can be:
>
> 'quit' The :quit command has been entered
>
> SUPPORTED COMMANDS
> Normal: a d f ga gg h i j k l m n o p q r t v x y D G O V 0 @ ` $ % /
> Command: :quit :nohlsearch :split :map


Looks good. You could also derive it from TextUndo and change the
undo binding to 'u' to match vi.

Similar ThreadsPosted
Sanity check: Date::Manip versus summer time January 24, 2006, 6:20 pm
Perl interface to Google GDS SDK May 9, 2005, 2:22 am
Module to interface to libmusicxml ? December 9, 2005, 10:20 am
GnuPG::Interface Hanging April 6, 2006, 10:45 am
html interface to a data tree December 14, 2004, 7:24 am
Has the interface to Proc::PID_File changed? January 5, 2005, 4:49 am
No queue support with the Sleepycat::Db Perl interface? March 28, 2006, 7:03 pm
ANNOUNCE: Curses interface for Config::Model May 15, 2007, 7:20 am
Announcing VCI: The Version Control Interface for Perl August 31, 2007, 9:37 am
Feedback requested on alternate interface to Time::Period March 8, 2007, 3:19 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap