Sublime Forum

Polish characters suddenly stopped working

#1

I’m using sublime-text on Linux Mint since a few years now and I see it as an awesome editor.

Unfortunately recently (beginning of 2022), I could not type polish characters anymore. I have never had this problem before but now whenever I press right_alt + n for example, nothing shows up in the editor.
I googled and looked on this forum but I only found some old problems that resulted in different characters being placed or different actions being conducted.
I looked at the key bindings and I see only two potentially conflicting but both of them do nothing:
{ “keys”: [“alt+o”], “command”: “switch_file”, “args”: {“extensions”: [“cpp”, “cxx”, “cc”, “c”, “hpp”, “hxx”, “hh”, “h”, “ipp”, “inl”, “m”, “mm”]} },
{ “keys”: [“alt+shift+o”], “command”: “switch_file”, “args”: {“extensions”: [“cpp”, “cxx”, “cc”, “c”, “hpp”, “hxx”, “hh”, “h”, “ipp”, “inl”, “m”, “mm”], “side_by_side”: true} },

Funny thing is that I can copy paste the letter from other text editor but not type it directly in the sublime.
Here are the letters that are used in polish with alt and alt+shift:

a z s e c n o l

I haven’t added any new plugins, and I haven’t changed the configuration in any way.
I tried to remove and install again but it didn’t work.

Does anyone have similar problem?

Do you know how to fix it?

Thanks in advance!

0 Likes

Special characters stopped working in beginning of 2022
#2

What makes alt+n type a Polish character? The input method, ST plugin or something?

0 Likes

#3

OS Keyboard layout I guess

0 Likes

#4

Keyboard layout hasn’t changed and is correct

I don’t have problems in other software and editors like visual studio code, xed, firefox, chrome…

@jfcherng
I didn’t have any custom plugins/methods and I have no idea what made it work before.

0 Likes

#5

what shows up in the ST console (View menu -> Show Console) after typing sublime.log_input(True); sublime.log_commands(True);Enter there and then pressing Alt+n?

0 Likes

#6
key evt: altgr+n
key evt: altgr+n

I added key bindings for altgr and it works!
There is one small issue left. With Caps lock enabled I still get lowercase letters.
Any key binding for that?

0 Likes

#7

it may be possible with a plugin to facilitate a custom key binding context to determine whether capslock is on or off, but I don’t have time to put a prototype together right now, sorry. Will get back to you if nobody beats me to it

It still feels like it shouldn’t be necessary though - ideally ST would detect what input is intended based on the OS keyboard layout. I’m trying to remember if there is a hidden setting to revert to old key detection behaviour…

0 Likes

#8

Sure no rush.
Thank you for the support!

Let me know if you need any logs, configs, etc.

0 Likes

#9

I have made a capslock detector suitable for use in keybindings.
in case you’ve not created custom plugins before, here’s what you will need to do:

  • Tools menu -> Developer -> New Plugin…
  • Select all
  • Replace with the code below
  • Save it, in the folder ST recommends (Packages/User/) with a .py extension - maybe call it capslock_state.py
import sublime
import sublime_plugin
import subprocess


CAPS_LOCK = 1
NUM_LOCK = 2


def get_keyboard_led_status():
    return int(chr(subprocess.check_output('xset q | grep LED', shell=True)[65]))


class CapsLockStateContextListener(sublime_plugin.EventListener):
    def on_query_context(self, view, key, operator, operand, match_all):
        if key == "caps_lock_state":
            lhs = get_keyboard_led_status() & CAPS_LOCK != 0
        else:
            return None

        rhs = bool(operand)

        if operator == sublime.OP_EQUAL:
            return lhs == rhs
        elif operator == sublime.OP_NOT_EQUAL:
            return lhs != rhs

        return None

I’m guessing you’d want your keybinding to look something like:

  { "keys": ["altgr+z"], "command": "insert", "args": { "characters": "Ż" }, "context": [
    { "key": "caps_lock_state", "operator": "equal", "operand": "true", },
  ], }

borrowed/improved the (Linux only) capslock detection from this StackOverflow answer

0 Likes

#10

Thanks a lot. I tried this config but it did not work. With just this binding and plugin nothing shows up when I type shift+alt+z or caps and alt+z.
Should I do something after saving the plugin or should it work straight after?

0 Likes