Forum > Debugger

Visual Studio keymap (for debugger and compiller)

<< < (4/5) > >>

Tango600:

--- Quote from: Martin_fr on June 13, 2022, 10:13:45 pm ---So you edited your copy of keymapping.pp ?

--- End quote ---

I did it.

And I created issue.
https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/39798#note_994415230

skalogryz:
for the discussion. Does it worth to modify loading XML process, thus it could understand characters, instead of integer codes for keys.

So instead of

--- Code: XML  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---    <Item9 Name="Build project/program">      <KeyA Default="False" Key1="117" Shift1="2"/>    </Item9> it would be possible to write:

--- Code: XML  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---    <Item9 Name="Build project/program">      <KeyA Default="False" Key1="F6" Shift1="Shift"/>    </Item9> (and if the actual number needs to be specified, it could be prefixed by some character)

--- Code: XML  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---    <Item9 Name="Build project/program">      <KeyA Default="False" Key1="*6" Shift1="Shift"/>    </Item9> (which would map to key "6")
Obviously, it's also possible to use a different attribute, i.e. Char1 (instead of Key1), BUT it also introduces a problem which one to use, if both are specified.

Purpose: to make the configuration of the key mapping files HUMAN friendly.

Btw, Visual Studio keyboard map XML is attached. It is based on Tango600's keyboard schema.

Martin_fr:

--- Quote from: skalogryz on June 18, 2022, 07:44:53 pm ---for the discussion. Does it worth to modify loading XML process, thus it could understand characters, instead of integer codes for keys.

--- End quote ---

That is an interesting question... I think in most cases the actual key, is more important.

IIRC by default Ctrl+/  comments the current line/selection. Never mind which Keycode the "/" has on the users keyboard layout.

For example, I use "Dovrak UK Punctuation".
The IDE has

--- Code: Text  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---  ecToggleComment:       SetSingle(VK_OEM_2,[XCtrl]);which did not work for me at all.
Having "ctrl" and "key=/" instead of a keycode, could help... or could mess it up.

On a German layout the "\" is only available via AltGr. Yet on an English layout the "\" has its own key.
Having something like ctrl-\  would then break, if a German user wants to load it.


--- Quote ---(and if the actual number needs to be specified, it could be prefixed by some character)

--- End quote ---
Actually, in that case the XML could have a "KeyCode"
 <Item9 Name="Build project/program">
      <KeyA Default="False" KeyCode1="117" Key1="F6" Shift1="2"/>
    </Item9>


--- Quote ---Btw, Visual Studio keyboard map XML is attached. It is based on Tango600's keyboard schema.

--- End quote ---

It will be a little time before I get to any of this. Quite busy right now.

I do think that the V.S. map is a great extension.
As for XML vs Build-in, I will wait what other devs have to say.

skalogryz:

--- Quote from: Martin_fr on June 18, 2022, 08:11:08 pm ---IIRC by default Ctrl+/  comments the current line/selection. Never mind which Keycode the "/" has on the users keyboard layout.

--- End quote ---
I see what you mean. Indeed layouts have different characters per same keycode.
Yet, if we define that characters are treated as US-layout characters and in the end are mapped to the corresponding key codes, this would be sufficient.
In the end, xml is to be human-friendly for the creator of such XML, not for the end-user.

For the end user the selection takes place through the UI only (and the contents of XML is not review).

Since you've brought that up.

How does this Key Edit dialog works:

There's a list of textual representation of keys (not just characters)
How does it map back to the key code? Does it respect the current layout, or is it fixed to a certain (US) layout?

Martin_fr:
I don't know what the dialog uses.

What we could use are the VK_### names: VK_A, VK_OEM.

Sadly, it seems we don't (yet? ;) ) have an IdentToInt for them.
See components\ideintf\idecommands.pas
  function IdentToIDECommand(const Ident: string; var Cmd: longint): boolean;
  function IDECommandToIdent(Cmd: longint; var Ident: string): boolean;

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version