houmain / keymapper

A cross-platform context-aware key remapper.
GNU General Public License v3.0
298 stars 25 forks source link

Fixed terminal commands containing comment symbols #12

Closed Azarattum closed 3 years ago

Azarattum commented 3 years ago

When a terminal command contains # or ; it should not be treated as commend. Broken use case example:

A >> $(start powershell -NoExit -command "$Host.UI.RawUI.WindowTitle = 'PowerShell'; cd ~")

; here breaks the config.

To fix it I moved comment parsing logic to ParseKeySequence.cpp, so we are aware of a context where a comment is found. However, we should still trim macros before processing the sequence, since they cannot contain terminal commands (original behavior) and comments in modifier blocks are unacceptable. This does not break:

MyMacro = A B C# comment
A >> Shift{MyMacro}

All tests passed successfully. Needed to do #include <sstream> fix in test.h too.

houmain commented 3 years ago

I noticed this in my first terminal command tests and thought about just removing the ; comments... But this solution is way better. Thanks!