Discussions related to Visual Prolog
User avatar
Thomas Linder Puls
VIP Member
Posts: 1398
Joined: 28 Feb 2000 0:01

Re: SciLexer tab key - line indent vs. tab insert

Unread post by Thomas Linder Puls »

In the sciLexer itself you can assign sciLexer-built-in actions to keys. But to perform your own custom commands you will need to handle the keypress before it reaches the sciLexer.

We have done that in a "hard coded" fashion to deal with the tab mechanism we want(ed).

I think it makes sense to make this hard coded thing into a "soft" facility instead. So we will do that, but it will include the extra determ level that Gukalov suggests, because it unnatural that the keys revert to their sciLexer assignments if you do not handle the keypress.

Try for example to assign the "shell open" action to Alt+up:

Code: Select all

        Lexer:addAssignedKey(vpiDomains::c_alt, gui_native::vk_up, ...
Now Alt+up will either open a hyperlink or move the current line upwards.
Regards Thomas Linder Puls
PDC
User avatar
Thomas Linder Puls
VIP Member
Posts: 1398
Joined: 28 Feb 2000 0:01

Re: SciLexer tab key - line indent vs. tab insert

Unread post by Thomas Linder Puls »

In future releases the sciLexer will have these key binding predicates, where the three last ones are new:

Code: Select all

predicates     assignCmdKey : (unsigned KeyDefinition, integer SciCommand).     % This assigns the given key definition to a Scintilla command identified by sciCommand.     % sciCommand can be any SCI_* command that has no arguments.     % Notice that custom key bindings (see #assignCustomKey) will shadow the sciLexer assignments.   predicates     clearCmdKey : (unsigned KeyDefinition).     % This makes the given key definition do nothing by assigning the action SCI_NULL to it.   predicates     clearAllCmdKeys : ().     % This command removes all keyboard command mapping by setting an empty mapping table.   predicates     assignCustomKey : (vpiDomains::keyModifier KeyModifier, vpiDomains::keyCode KeyCode, runnable Action).     % Assign a key (#KeyModifier+#KeyCode) to a custom command.     % If a custom action is assigned to a key the normally assigned Cmd will not have any effect.     % See also #assignCmdKey.     % By default copy and cut operations are assigned to custom actions that place HTML format on the clipboard.     % Also by default tab ans shift+tab are assigned to indent/unintent behvior.   predicates     clearCustomKey : (vpiDomains::keyModifier KeyModifier, vpiDomains::keyCode KeyCode).     % Clear the custom key binding of the key: #KeyModifier+#KeyCode.   predicates     clearAllCustomKeys : ().     % Clear all custom key bindings (including the default assignments, see #assignCustomKey).s
Regards Thomas Linder Puls
PDC
Post Reply