View Issue Details

IDProjectCategoryView StatusLast Update
0037966LazarusLCLpublic2020-12-29 23:58
ReporterCudaText man Assigned ToJuha Manninen  
PrioritynormalSeverityminorReproducibilityN/A
Status resolvedResolutionfixed 
Product Version2.1 (SVN) 
Summary0037966: Give new name to left-Backslash key on 102-keys keyboard
Descriptionhttps://github.com/Alexey-T/CudaText/issues/2923
User wants to use left Backslash for special action.
Key code for it: 226=$E2
ShortcutToText maps it to '\'.
Bad!

Let's map it to new name.
https://docs.microsoft.com/en-us/dotnet/api/system.windows.forms.keys?view=netcore-3.1
From this page I suggest "OemBackslash'.

Patch is easy. LCLProc.pas

This line is ok:
        '\', // 0xdc - VK_OEM_5 - Can vary by keyboard, US keyboard, the '\|' key

     
This line to fix:
        '\', // 0xe2 - VK_OEM_102 - Either the angle bracket key or the backslash key on the RT 102-key keyboard

     

TagsNo tags attached.
Fixed in Revisionr64304
LazTarget-
Widgetset
Attached Files

Activities

Bart Broersma

2020-10-22 18:58

developer   ~0126468

And you want to change that into what?
Please attach a proper patch.

CudaText man_

2020-10-22 21:55

reporter   ~0126473

attached. User said that now it works OK.
key.diff (584 bytes)   
Index: lcl/lclproc.pas
===================================================================
--- lcl/lclproc.pas	(revision 64045)
+++ lcl/lclproc.pas	(working copy)
@@ -643,7 +643,7 @@
     'OEM_8', // 0xdf - VK_OEM_8
     '', // 0xe0
     'OEM_0xE1', // 0xe1
-    '\', // 0xe2 - VK_OEM_102 - Either the angle bracket key or the backslash key on the RT 102-key keyboard
+    'OEM_Backslash', // 0xe2 - VK_OEM_102 - Either the angle bracket key or the backslash key on the RT 102-key keyboard
     'OEM_0xE3', // 0xe3
     'OEM_0xE4', // 0xe4
     'IME_process', // 0xe5 - VK_PROCESSKEY
key.diff (584 bytes)   

jamie philbrook

2020-10-22 23:07

reporter   ~0126478

before we go and start remapping keys I think we should look at the effects this may cause

if there are some special keys that I don't know about that does not come up on the standard list then I guess it does not matter but really.

 Just deciding to change the left back slash ? I can't see how that can help anyone but I can see how it can hurt..

CudaText man_

2020-10-22 23:51

reporter   ~0126480

> I can't see how that can help anyone

look. in CudaText we have config in json format, it saves TEXT NAMES of hotkeys. names are got using ShortcutToText(). so for Left Backslash, CudaText saves '\' string. it reads it back. and makes hotkey NOT to Left Backslash but to usual backslash. So before Left Backslash didn't work. Now it works.

wp

2020-10-23 00:16

developer   ~0126481

What is Delphi doing here?

Bart Broersma

2020-10-23 14:10

developer   ~0126488

Last edited: 2020-10-23 14:16

View 3 revisions

@jamie: he's just changing the string representation of that particular key.
That may not be such a big problem, I think.

If we do so, we should document it in the release notes for 2.2.

Bart Broersma

2020-10-23 14:15

developer   ~0126489

@CudaText man: you seem to have 2 seprate login's, one ending with "man_", one with "man".
Please always write with the same login as you used to create this bugreport.
The reason I ask this is the behaviour of the bugtracker:
- I set status to "feedback" (issue turns purple)
- You reply: issue is set back to the status it had, before I set it to feedback: issue isn't purple anymore.

So from the "main view" page I can see wether or not you responded.

Now yo responded with a different login, so this does not work.
You should realize that normally I do not look again at such an issue, unless it's status is no longer "feedback", and so will most devels.

CudaText man

2020-10-23 14:25

reporter   ~0126490

Ok, thanks for note. I replied above.

Sven Barth

2020-10-23 20:55

manager   ~0126494

Last edited: 2020-10-23 20:55

View 2 revisions

> What is Delphi doing here?

Delphi relies on Windows functionality here as it essentially does the following:

program tkeyname;

uses
  SysUtils, Windows;

var
  s: UnicodeString;
  i: LongInt;
  k: UInt;
begin
  SetLength(s, 100);
  k := MapVirtualKey($e2, 0);
  i := GetKeyNameTextW(k shl 16, @s[1], Length(s));
  if i = 0 then begin
    Writeln('Failed: ', SysErrorMessage(GetLastOSError));
  end
  else begin
    SetLength(s, i);
    Writeln(s);
  end;
end.


On my system it return “MOD 3 RECHTS” and according to MSDN ( https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getkeynametextw ) this comes from the keyboard layout which in my case is a non-standard keyboard layout. Maybe someone can test that on an English Windows to see what Windows returns here...

Bart Broersma

2020-10-24 11:19

developer   ~0126505

It says "\" on my PC (I have 2 "\" keys on that keyboard, the left backslah key has $e2 as keycode (?), the right one has $dc.
GetKeyNameTextW gives the same result for both.
I'm on a Dutch locale.

CudaText man_

2020-12-29 10:57

reporter   ~0127890

Again, pls apply this tiny patch. CudaText user says its OK for him, and i don't want to loose my fix when i "reset the Lazarus".

Bart Broersma

2020-12-29 16:39

developer   ~0127897

> CudaText user says its OK for him
That in itself is no argument to change this.

wp

2020-12-29 17:03

developer   ~0127902

A stupid question: I looked a the source and indeed in lclProc there is the line:

    '\', // 0xe2 - VK_OEM_102 - Either the angle bracket key or the backslash key on the RT 102-key keyboard

If this is up-to-date then even the current assignment to '\' looks strange because the comment says "EITHER the angle bracket or the backslath". This means that there are users, probably with US keyboards, who are pressing an angle bracket but see a backslash on the screen? Smells wrong...

Juha Manninen

2020-12-29 23:58

developer   ~0127919

I applied it. I cannot test with all locales but the change looks reasonable and quite safe.
If regressions come, then we fix them.

Issue History

Date Modified Username Field Change
2020-10-22 11:40 CudaText man New Issue
2020-10-22 18:58 Bart Broersma Note Added: 0126468
2020-10-22 18:59 Bart Broersma Status new => feedback
2020-10-22 18:59 Bart Broersma LazTarget => -
2020-10-22 21:55 CudaText man_ Note Added: 0126473
2020-10-22 21:55 CudaText man_ File Added: key.diff
2020-10-22 23:07 jamie philbrook Note Added: 0126478
2020-10-22 23:51 CudaText man_ Note Added: 0126480
2020-10-23 00:16 wp Note Added: 0126481
2020-10-23 14:10 Bart Broersma Note Added: 0126488
2020-10-23 14:15 Bart Broersma Note Added: 0126489
2020-10-23 14:16 Bart Broersma Note Edited: 0126488 View Revisions
2020-10-23 14:16 Bart Broersma Note Edited: 0126488 View Revisions
2020-10-23 14:25 CudaText man Note Added: 0126490
2020-10-23 14:25 CudaText man Status feedback => new
2020-10-23 20:55 Sven Barth Note Added: 0126494
2020-10-23 20:55 Sven Barth Note Edited: 0126494 View Revisions
2020-10-24 11:19 Bart Broersma Note Added: 0126505
2020-12-29 10:57 CudaText man_ Note Added: 0127890
2020-12-29 16:39 Bart Broersma Note Added: 0127897
2020-12-29 17:03 wp Note Added: 0127902
2020-12-29 23:55 Juha Manninen Assigned To => Juha Manninen
2020-12-29 23:55 Juha Manninen Status new => assigned
2020-12-29 23:58 Juha Manninen Status assigned => resolved
2020-12-29 23:58 Juha Manninen Resolution open => fixed
2020-12-29 23:58 Juha Manninen Fixed in Revision => r64304
2020-12-29 23:58 Juha Manninen Note Added: 0127919