[Tkabber-dev] r85 - trunk/plugins/unixkeys

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Wed Jan 2 04:57:37 MSK 2008


Author: kostix
Date: 2008-01-02 04:57:37 +0300 (Wed, 02 Jan 2008)
New Revision: 85

Added:
   trunk/plugins/unixkeys/AUTHORS
   trunk/plugins/unixkeys/INSTALL
   trunk/plugins/unixkeys/README
   trunk/plugins/unixkeys/TODO
   trunk/plugins/unixkeys/unixkeys.tcl
Log:
Initial import of the "Unixkeys" plugin files.


Added: trunk/plugins/unixkeys/AUTHORS
===================================================================
--- trunk/plugins/unixkeys/AUTHORS	                        (rev 0)
+++ trunk/plugins/unixkeys/AUTHORS	2008-01-02 01:57:37 UTC (rev 85)
@@ -0,0 +1 @@
+Konstantin Khomoutov <flatworm at users.sourceforge.com>


Property changes on: trunk/plugins/unixkeys/AUTHORS
___________________________________________________________________
Name: svn:eol-style
   + native

Added: trunk/plugins/unixkeys/INSTALL
===================================================================
--- trunk/plugins/unixkeys/INSTALL	                        (rev 0)
+++ trunk/plugins/unixkeys/INSTALL	2008-01-02 01:57:37 UTC (rev 85)
@@ -0,0 +1,9 @@
+As usually, copy this directory under the ~/.tkabber/plugins directory
+so that you get a hierarchy like this:
+  ~/.tkabber/plugins
+  ~/.tkabber/plugins/unixkeys/
+  ~/.tkabber/plugins/unixkeys/unixkeys.tcl
+
+Restart Tkabber, to get the plugin loaded.
+Consult the README file for the details about using this plugin.
+


Property changes on: trunk/plugins/unixkeys/INSTALL
___________________________________________________________________
Name: svn:eol-style
   + native

Added: trunk/plugins/unixkeys/README
===================================================================
--- trunk/plugins/unixkeys/README	                        (rev 0)
+++ trunk/plugins/unixkeys/README	2008-01-02 01:57:37 UTC (rev 85)
@@ -0,0 +1,125 @@
+$Id$
+"Unixkeys" -- plugin for Tkabber.
+
+
+I. The idea
+
+This plugins adds some Unix-style keybindings to Tk widgets of
+class Text -- those that are used for chat input windows in
+Tkabber.
+
+The text "Unix-style" is vague, so more precisely it stands for
+something like "resembles default keybindings of Emacs text
+editor and Readline library". That is, these keybindings should
+be familiar to those using bash and Emacs. See the next section
+for complete listing of keybindings.
+
+
+II. Usage
+
+After this plugin is loaded by Tkabber, the keybindings it
+provides are available in all Tkabber's widgets of type "Text"
+(i.e. all multiline text editing controls).
+
+The keybindings added are:
+
+* M-a -- move cursor to the start of text.
+* M-e -- move cursor to the end of text (but see below).
+
+* M-f -- move cursor one word forward.
+* M-b -- move cursor one word backward.
+
+* C-u -- delete text from the cursor to the beginning of the
+         current line.
+
+* M-BackSpace, C-w -- delete text from the cursor to the start
+                      of the current word.
+
+* M-BackSpace, M-d -- delete text from the cursor to the end
+                      of the current word.
+
+* C-x C-u -- Undo the last change.
+
+* C-x h -- Select all text.
+
+Also, on Windows, another keybinding is added:
+
+* C-_ (Ctrl-Underscore) -- Undo the last change.
+
+And, finally, one convenience binding is added (this one is
+borrowed from Tk list widget):
+
+* C-\ (Ctrl-backslash) -- Select all text.
+
+
+Since Tk text widgets already provide some Unix-style bindings,
+we can summarise the "complete Unix-style editing" capabilities
+which those widgets provide in concert with this plugin:
+
+* C-f, C-b -- move cursor one character forward/backward.
+
+* M-f, M-b -- move cursor one word forward/backward.
+
+* C-a, C-e -- move cursor to the start/end of the current line.
+
+* M-a, M-e -- move cursor to the start/end of text.
+
+* C-h, C-d -- delete one character to the left/right from
+              the cursor.
+
+* C-w, M-BackSpace -- delete text to the start of the current
+                      word.
+
+* M-d, M-Delete -- delete text to the end of the current word.
+
+* C-u, C-k -- delete text from the cursor to the start/end of
+              the current line.
+
+* C-x C-u, C-_, C-z -- Undo the last change.
+
+* C-\, C-x h -- Select all text.
+
+
+III. Configuration.
+
+No configuration is needed except for one issue explained below.
+
+The built-in Tkabber plugin providing support for emoticons
+binds its action "show menu with available emoticons" to M-e
+(<Alt-Key-e> and <Meta-Key-e>) in chat input windows thus
+effectively cancelling the effect of pressing M-e which this
+plugin adds.
+
+If you prefer M-e to be used for cursor motion as provided by
+this plugin, add something like construct in the postload
+section of your config.tcl:
+
+foreach b [event info <<EmoticonsMenu>>] {
+	event delete <<EmoticonsMenu>> $b
+}
+
+This will unbind *all* bindings from the Tk virtual event that
+shows the emoticons palette, effectivly disabling its usage.
+If you want to access this palette via some other gesture, add
+it like this, for instance:
+
+event add <<EmoticonsMenu>> <F10>
+
+This will made the emoticons palette to pop up when you press
+<F10> on your keyboard.
+
+
+IV. Limitations.
+
+The bindings provided work only in multiline edit controls, they
+won't work in one-line edit controls (entry boxes).
+
+The bindings do not match *exactly* the behaviours of software
+they borrow from. For example, M-e in Emacs stands for "end of
+sentence", not "end of text in the buffer" as this plugin does.
+
+The plugin requires special tweaking to get M-e working, as
+described above.
+
+
+# vim:tw=64:noet


Property changes on: trunk/plugins/unixkeys/README
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Added: trunk/plugins/unixkeys/TODO
===================================================================
--- trunk/plugins/unixkeys/TODO	                        (rev 0)
+++ trunk/plugins/unixkeys/TODO	2008-01-02 01:57:37 UTC (rev 85)
@@ -0,0 +1,7 @@
+$Id$
+
+* Should also work in Entry widgets.
+
+* M-a, M-e should move by sentencies.
+
+# vim:tw=64:noet


Property changes on: trunk/plugins/unixkeys/TODO
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Added: trunk/plugins/unixkeys/unixkeys.tcl
===================================================================
--- trunk/plugins/unixkeys/unixkeys.tcl	                        (rev 0)
+++ trunk/plugins/unixkeys/unixkeys.tcl	2008-01-02 01:57:37 UTC (rev 85)
@@ -0,0 +1,41 @@
+# $Id$
+# "Unixkeys" -- plugin for Tkabber.
+# Provides keybindings in Tk Text widgets which are familiar
+# to Unix users: they resemble "canonical" bindings found in
+# readline and Emacs.
+# Written by Konstantin Khomoutov <flatworm at users.sourceforge.net>
+
+namespace eval unixkeys {
+	foreach mod {Alt Meta} {
+		bind Text <$mod-a> [bind Text <Control-Key-Home>]
+		bind Text <$mod-e> [bind Text <Control-Key-End>]
+	}
+
+	foreach mod {Alt Meta} {
+		bind Text <$mod-b> [bind Text <Control-Key-Left>]
+		bind Text <$mod-f> [bind Text <Control-Key-Right>]
+	}
+
+	bind Text <Control-u> { %W delete {insert linestart} insert}
+
+	foreach {mod key} {Alt BackSpace Control w} {
+		bind Text <$mod-Key-$key> { %W delete [tk::TextPrevPos %W insert tcl_startOfPreviousWord] insert }
+	}
+
+	foreach key {d Delete} {
+		foreach mod {Alt Meta} {
+			bind Text <$mod-Key-$key> { %W delete insert [::tk::TextNextPos %W insert tcl_endOfWord] }
+		}
+	}
+
+	if {[string equal $::tcl_platform(os) windows]} {
+		event add <<Undo>> <Control-Key-underscore>
+	}
+	event add <<Undo>> <Control-Key-x><Control-Key-u>
+
+	bind Text <Control-backslash> { %W tag add sel 1.0 end }
+	bind Text <Control-Key-x><h> { %W tag add sel 1.0 end }
+}
+
+namespace delete unixkeys
+


Property changes on: trunk/plugins/unixkeys/unixkeys.tcl
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native



More information about the Tkabber-dev mailing list