|
WikiDoc |
The [regPrefixChar] commandCommands.RegPrefixCharCommand HistoryHide minor edits - Show changes to markup September 30, 2009, at 09:04 AM
by - Removed experimental
Changed line 2 from:
to:
June 10, 2008, at 01:59 PM
by - Typo
Changed lines 23-26 from:
to:
[0-5abc] April 28, 2007, at 03:11 PM
by - Added sentence about empty infix
Deleted line 0:
Added lines 72-75:
If the user did not enter any number or character recognized as an infix and pressed ctrl-B S directly then the argument appended to the proc would be empty. April 26, 2007, at 06:25 AM
by - numPrefixChar becomes regPrefixChar
Changed lines 1-22 from:
(:title The [numPrefixChar] command:)
The [numPrefixChar] command lets you define composite bindings
which expect a number to be entered before an action is triggered. For
instance, the Embrace package implements complex bindings involving an
infix, like Until now, in order to obtain such a behavior, one had to implement a series of bindings involving the [prefixChar] command. This technique allows only for a limited set of values for the number (currently the Embrace package installs bindings for values 1 to 5). The new [numPrefixChar] command simplifies the definition of bindings with an infix number and removes the limitation: it is now possible to enter any value for the infix number. Here is an example to demonstrate how it works. Say we want to define a complex binding like to:
(:title The [regPrefixChar] command:)
IntroductionThe [regPrefixChar] command lets you define composite bindings
involving an infix. For instance, the Embrace package implements
complex bindings like The new [regPrefixChar] command lets you specify a regular expression defining the permitted values for the infix. SynopsisThe syntax of the [regPrefixChar] command is Changed line 21 from:
ctrl-B num S to:
regPrefixChar -regexp expr ?-prompt str? Changed lines 23-24 from:
where num is any integer value. This example makes use of the new [binding] command also introduced to:
The arguments have the following meaning:
Concerning the infix, the following rules apply: in the case digits are allowed by the regular expression, it is possible to enter several digits in a row, that is to say to compose numbers, before the key combo. Otherwise the infix is a single character. For instance, in the example above, the infix could be either a number composed of digits between 0 and 5 (like 1, 20, 54321, etc.) or one of the letters a, b, or c. HowtoHere is an example to demonstrate how the command works. Say we want to define a complex binding like
ctrl-B infix S
where infix is iether a number or the letter r. Note that this example makes use of the new [binding] command introduced Changed lines 45-46 from:
for more details about this command. to:
for more details about it. Changed lines 53-54 from:
The simple to:
The Changed line 57 from:
binding create {z 'B'} numPrefixChar
to:
binding create {z 'B'} {regPrefixChar -regex {[0-9r]}}
Changed lines 59-64 from:
Now, when the user presses to:
The regular expression Now, when the user presses Changed lines 71-79 from:
If the user did not enter any number and pressed ctrl-B S directly then no additional argument would be appended to the proc. This implies that the proc's last argument, representing the infix, be of type default (argument with a default value). For instance
proc fooActionProc {arg1 arg2 ... {infix ""} } {
# definition
}
to:
with the result that the 15 preceding words will be enclosed in a pair of brackets. Changed lines 74-75 from:
(add your comments here...) to:
(add your comments here...) April 24, 2007, at 02:00 PM
by - Updated doc ([action] command removed)
Deleted line 0:
Changed line 40 from:
binding create {z 'B'} prefixChar
to:
binding create {z 'B'} numPrefixChar
April 24, 2007, at 01:59 PM
by - Updated doc ([action] command removed)
Changed lines 3-4 from:
to:
Changed lines 28-34 from:
This example makes use of the new [binding] command also introduced in version 8.2a1d1 of AlphaX. See the BindingCommand page for more details about this command. The action triggered by the combo must be defined with the [action] command. For instance: to:
This example makes use of the new [binding] command also introduced in version 8.2a1d1 of AlphaX. See the BindingCommand page for more details about this command. The action triggered by the combo is a Tcl proc or a Tcl script. The composite binding is defined with the [binding] command and takes the Tcl script as its last argument. For instance: Changed line 36 from:
set theAction [action create -script {embrace::toggle "\[" "\]"}]
to:
binding create -prefix {z 'B'} {"" 'S'} {embrace::toggle "\[" "\]"}]
Changed lines 38-39 from:
The composite binding is defined with the [binding] command and takes the action token as its last argument: to:
The simple Changed line 41 from:
binding create -prefix {z 'B'} {"" 'S'} $theAction
to:
binding create {z 'B'} prefixChar
Deleted lines 42-47:
The simple
set countAction [action create -script "numPrefixChar"]
binding create {z 'B'} $countAction
Changed lines 62-63 from:
(add your comments here...) to:
(add your comments here...) February 19, 2007, at 07:45 PM
by - Renamed the command [numPrefixChar]
Changed lines 1-6 from:
(:title The [countedPrefixChar] command:)
The [countedPrefixChar] command lets you define composite bindings to:
(:title The [numPrefixChar] command:)
The [numPrefixChar] command lets you define composite bindings Changed line 17 from:
The new [countedPrefixChar] command simplifies the definition to:
The new [numPrefixChar] command simplifies the definition Changed lines 27-31 from:
This example makes use of the new [action] and [binding] commands also introduced in version 8.2a1d1 of AlphaX. See the ActionCommand and BindingCommand pages for more details about these commands. to:
This example makes use of the new [binding] command also introduced in version 8.2a1d1 of AlphaX. See the BindingCommand page for more details about this command. Changed line 42 from:
The simple to:
The simple Changed line 45 from:
set countAction [action create -script "countedPrefixChar"] to:
set countAction [action create -script "numPrefixChar"] Changed lines 49-50 from:
(possibly several digits) and a non-digit keypress (the letter to:
(possibly several digits) and a non-digit keypress (the letter Changed line 60 from:
type default (argument with a default value). For instance to:
type default (argument with a default value). For instance Changed line 67 from:
(add your comments here...) to:
(add your comments here...) February 08, 2007, at 09:55 AM
by - Doc for new [countedPrefixChar] command (minor fixes)
Changed line 23 from:
Here is an example to demonstrate this works. Say we want to define a to:
Here is an example to demonstrate how it works. Say we want to define a Changed line 51 from:
(possibly several digits) and the letter to:
(possibly several digits) and a non-digit keypress (the letter Changed line 61 from:
type default. For instance to:
type default (argument with a default value). For instance February 08, 2007, at 09:12 AM
by - Doc for new [countedPrefixChar] command
Added lines 4-5:
February 08, 2007, at 09:11 AM
by - Doc for new [countedPrefixChar] command
Added lines 1-66:
(:title The [countedPrefixChar] command:)
The [countedPrefixChar] command lets you define composite bindings
which expect a number to be entered before an action is triggered. For
instance, the Embrace package implements complex bindings involving an
infix, like Until now, in order to obtain such a behavior, one had to implement a series of bindings involving the [prefixChar] command. This technique allows only for a limited set of values for the number (currently the Embrace package installs bindings for values 1 to 5). The new [countedPrefixChar] command simplifies the definition of bindings with an infix number and removes the limitation: it is now possible to enter any value for the infix number. Here is an example to demonstrate this works. Say we want to define a complex binding like
ctrl-B num S
where num is any integer value. This example makes use of the new [action] and [binding] commands also introduced in version 8.2a1d1 of AlphaX. See the ActionCommand and BindingCommand pages for more details about these commands. The action triggered by the combo must be defined with the [action] command. For instance:
set theAction [action create -script {embrace::toggle "\[" "\]"}]
The composite binding is defined with the [binding] command and takes the action token as its last argument:
binding create -prefix {z 'B'} {"" 'S'} $theAction
The simple
set countAction [action create -script "countedPrefixChar"]
binding create {z 'B'} $countAction
Now, when the user presses
embrace::toggle "\[" "\]" 15
If the user did not enter any number and pressed ctrl-B S directly then no additional argument would be appended to the proc. This implies that the proc's last argument, representing the infix, be of type default. For instance
proc fooActionProc {arg1 arg2 ... {infix ""} } {
# definition
}
(add your comments here...) |
|
Edit -
History -
Print -
Recent Changes -
Search
Page last modified on September 30, 2009, at 09:04 AM
|
Hosted on
|