News:

The new Release 25.03 is out! You can download binaries for Windows and many major Linux distros here .

Main Menu

Edit shortcuts stopped working !

Started by gul, April 15, 2020, 07:07:55 PM

Previous topic - Next topic

gul

Hey thanks again for quick reply,

Yes in settings textboxes everything works properly, only in editor does not.

Quote from: oBFusCATed on April 17, 2020, 09:08:50 PM
Also are you able to build the software manually.
I'm not sure what you mean, you want me to try to build CB from source on my machine or?

locale:
LANG=sr_RS
LANGUAGE=sr_RS
LC_CTYPE="sr_RS"
LC_NUMERIC=sr_RS
LC_TIME=sr_RS
LC_COLLATE="sr_RS"
LC_MONETARY=sr_RS
LC_MESSAGES="sr_RS"
LC_PAPER=sr_RS
LC_NAME=sr_RS
LC_ADDRESS=sr_RS
LC_TELEPHONE=sr_RS
LC_MEASUREMENT=sr_RS
LC_IDENTIFICATION=sr_RS
LC_ALL=

oBFusCATed

Why are you using non-utf8 locale?

This is a commit which tried to make shortcuts work on non English locales/layout...
https://github.com/obfuscated/codeblocks_sf/commit/e26acf44b8ece212205423e2d57c392dc8ac2ad6
But I guess it doesn't work correctly.

Can you compile the latest wxwidgets master branch? You have to compile and test the samples/stc sample.
It would be interesting to know if shortcuts work there. My guess is that they won't work.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

oBFusCATed

Also do you have scite, geany or something else which is based on scintilla? Does shortcuts work there?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

gul

I didn't know non-UTF8 locale is a bad thing haha, why is that? I just recently changed it from default ENG.
Funny thing is i still have the problem even if i switch back to ENG locale.

I'll try to compile everything from source but it will take some time,

Ye I have geany it works as it should but its not codeblocks haha.

oBFusCATed

I guess the locale is not involved in this. But you definitely should use a utf8 locale, but it might be too late (if you have saved files with non-ascii symbols they might be broken if you change the locale). Using non-utf8 locale I think would mean that you either use a the upper half of the 1 byte or multi-byte/fixed size locale. You should read up. But generally programs on linux kind of expect a utf8...
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

gul

Ok, thanks, i changed the locale to UTF8, thankfully i didn't use non ANCII chars in beetween.

Anyway I compiled wxWidgets from git, and stc sample works correctly, i can copy paste etc. there.

After that i built CB from SVN and i still have the problem, but another thing is i ran CB from terminal and it keep printing this message:
The Parser is still parsing files. > Reasons:
- still need to mark files as local


I get the same message on an overlay in editor while i type, dont know if its related.


oBFusCATed

I don't think the parsing problem is related.

On the original problem:
Interesting. So you don't have the problem in the stc sample...
Can you please put some printfs in the function I've highlighted in CB and do a build?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

gul

Sorry, what function do you mean exactly?

oBFusCATed

(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

gul

Ok, i recomplited it with 4 printfs, it looks to me like the function registers keystrokes corrently, but still nothing happens on screen.

For example this is what i get with CTRL-A:

1. KEY: 308  CTRL: 1
2. KEY: 308  CTRL: 1
4. KEY: 0  CTRL: 1  RV: 0

1. KEY: 1729  CTRL: 1
2. KEY: 1729  CTRL: 1
4. KEY: 1729  CTRL: 1  RV: 0


I used ENG keyboard.

oBFusCATed

What is the value of 'key' passed to KeyDownWithModifiers? For Ctrl-A it should be 'A' or 65...

Can you show me the result of git diff?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

gul

I use mostly pure C and ASM, I'm not very good with Cpp so I don't fully understand what happens in int rv = KeyDownWithModifiers,
but to me it looks like when I press just CTRL i get 308, and A seems to be 1729,
I thought these are keycodes so they don't have to match actual ASCII char values, no?
And in that case shouldn't 65 / 'A' be CTRL-SHIFT-A ?

I used SVN instead of git because I had the files already, hope that's ok.

Index: ScintillaWX.cpp
===================================================================
--- ScintillaWX.cpp (revision 12064)
+++ ScintillaWX.cpp (working copy)
@@ -1162,8 +1162,12 @@
     const int WXK_NONE = 0;
#endif // wxCHECK_VERSION
/* C::B end */
+
+    printf("1. KEY: %d  CTRL: %d \n",key,ctrl);
     if (ctrl && key >= 1 && key <= 26 && key != WXK_BACK)
         key += 'A' - 1;
+   
+    printf("2. KEY: %d  CTRL: %d \n",key,ctrl);

     switch (key) {
     case WXK_DOWN:              key = SCK_DOWN;     break;
@@ -1202,6 +1206,8 @@
     case WXK_SHIFT:             key = 0; break;
     case WXK_MENU:              key = SCK_MENU; break;
     case WXK_NONE:
+   
+    printf("3. KEY: %d  CTRL: %d \n",key,ctrl);
#ifdef __WXGTK20__
         if (ctrl)
         {
@@ -1268,7 +1274,7 @@
                 ),
                 consumed
              );
-
+    printf("4. KEY: %d  CTRL: %d  RV: %d \n",key,ctrl,rv);
     if (key)
         return rv;
     else

oBFusCATed

This is the log from pressing ctrl-shift-a on my machine.

1. KEY: 308  CTRL: 1
2. KEY: 308  CTRL: 1
4. KEY: 0  CTRL: 1  RV: 0
1. KEY: 306  CTRL: 1
2. KEY: 306  CTRL: 1
4. KEY: 0  CTRL: 1  RV: 0
1. KEY: 65  CTRL: 1
2. KEY: 65  CTRL: 1
4. KEY: 65  CTRL: 1  RV: 0


And this is ctrl-a

1. KEY: 308  CTRL: 1
2. KEY: 308  CTRL: 1
4. KEY: 0  CTRL: 1  RV: 0
1. KEY: 65  CTRL: 1
2. KEY: 65  CTRL: 1
4. KEY: 65  CTRL: 1  RV: 0


This is the output of ctrl-a when I switch to bulgarian layout:

1. KEY: 308  CTRL: 1
2. KEY: 308  CTRL: 1
4. KEY: 0  CTRL: 1  RV: 0
1. KEY: 0  CTRL: 1
2. KEY: 0  CTRL: 1
3. KEY: 0  CTRL: 1
4. KEY: 65  CTRL: 1  RV: 0


Can you apply the same patch to wx's stc and print the output?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

oBFusCATed

Quote from: gul on April 19, 2020, 02:05:11 AM
I thought these are keycodes so they don't have to match actual ASCII char values, no?

See the code after "printf("3. KEY: %d  CTRL: %d \n",key,ctrl);"
Its job is to remap the keycode to the ASCII value.
The idea is to try to translate the pressed key to the key code if the same button is pressed on a qwerty English keyboard.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

gul

Haha, ok i found out where the problem is. I have 3 keyboard layouts ENG, SER latin and SER cyrilic.
Now I was sure i tested all 3, but now when i tried again with the cyrilic layout it works !

This is the output.
1. KEY: 308  CTRL: 1
2. KEY: 308  CTRL: 1
4. KEY: 0  CTRL: 1  RV: 0
1. KEY: 0  CTRL: 1
2. KEY: 0  CTRL: 1
3. KEY: 0  CTRL: 1
4. KEY: 65  CTRL: 1  RV: 0


The problem is i use mostly ENG keyboard layout especially in CB. From what i see the code to convert the keycode to ASCII only runs in case WXK_NONE: (when the key is 0).
So on my machine it never enters that part of the code, beacuse i get 1729 for A on ENG layout.
I'll try to reset keyboard layout settings to see if that will fix the problem