Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Terminating with std::out_of_range #1

Closed
ezag opened this issue Dec 9, 2012 · 7 comments
Closed

Terminating with std::out_of_range #1

ezag opened this issue Dec 9, 2012 · 7 comments

Comments

@ezag
Copy link

ezag commented Dec 9, 2012

Fox xkb_symbols string like pc+us+ru(winkeys):2+ua(winkeys):3+inet(evdev)+group(toggle)

running with non-first group active produces error

terminate called after throwing an instance of 'std::out_of_range'
  what():  vector::_M_range_check

It seems that symbols followed by '(' should not be ignored unconditionally like they do since 42abcc0.

@ierton
Copy link
Collaborator

ierton commented Dec 11, 2012

Thanks a lot. I should have checked that. I've reverted 42abcc0 and applied simpler fix of the original problem.

@ierton ierton closed this as completed Dec 11, 2012
@relghuar
Copy link

Hello, your fix is actually a bit wrong. It gets rid of the error, but skips flavoured layouts.
I have following xkb_symbols: 'pc+us+sk(qwerty):2+at:3+inet(evdev)+compose(ralt)', and "xkb-switch -l" can only see us and at layouts. This is pretty obvious once you look at the code - when you find ( after sk you simply stop parsing symbol without storing what you already parsed into the symbol list. It would cause the same problem for original xkb_symbols above, where it would miss the ru and ua layouts.
Solution is to include whole "if (inSymbol && ...)" condition with push_back into the "if (inSymbol && ch == '(')" branch before "inSymbol = false;". At least that works for me - perhaps it would be necessary to add more symbols to _nonSymbols, though I've seen you already included things like capslock and terminate...
Regards,
Peter

@ierton
Copy link
Collaborator

ierton commented Dec 19, 2012

Hi. Thanks for the report. Looks like I didn't understand the problem: my idea was to exclude all tokens with '(' ')' from the final list, because I thought they don't name layouts. Unfortunately, this is not true. Do you know some spec or manual describing the format of layout string? I'll add the option allowing users to view debug info.

@ierton ierton reopened this Dec 19, 2012
@relghuar
Copy link

Honestly no idea :-) I haven't played in this area at all. From a short look-around the format looks pretty simple, apparently a little program called xkblayout-state from AUR gets it right. It uses numbers to set active layout instead of layout symbols. This might actually be a smart way. For testing I've just included a new layout to my list, it's US but with "alternative international" flavour. Now my symbols string is 'pc+us+sk(qwerty):2+at:3+us(alt-intl):4+inet(evdev)+compose(ralt)' and "xkb-switch -l" gives "us sk at us" - so the question is when I now call "xkb-switch -s us", which one do I actually mean? I've tried it and it always sets the first layout with given symbol name, which is not an ideal solution if you actually need more layouts of the same language. Perhaps it might be useful to add another parameter, or at least a possibility to call "xkb-switch -s <lang>(<flavour>)" or something like that :-) so if you call it without specific flavour, it chooses the first matching layout, but it would also be possible to select different layouts of the same language.

@ierton
Copy link
Collaborator

ierton commented Dec 19, 2012

I've implemented lang(flavour) idea. Actually, '(flavour)' is now just a part of layout name. Please let me know if it doesn't work.

@ierton
Copy link
Collaborator

ierton commented Dec 19, 2012

Note also --test option ;)

@relghuar
Copy link

Works for me now, thanks :-) I had to modify key association for sk to sk(qwerty), other than that no problems.
The test option is funny :-D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants