Bug: Serial Monitor keyboard shortcut inserts CR

Same as reported back in March of 2010 (Arduino v0018) here: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1268106229

The shortcut key to activate the Serial Monitor is CTRL + SHIFT + M also inserts a CR. As an added bonus: if you have code selected, it will also be deleted :cold_sweat:. Either way your code is somewhat destroyed every time you use this combination of keys.

Yes, there is a beautiful icon in the upper-right but I always avoid using the mouse as much as possible when coding (old habits die hard), there's a reason hotkeys are also called accelerators ;)

Suggestion for a quick and painless solution: Please change the hotkey! :)

OS: Win7 64-bit.

Try the same thing in any Windows program. Its an "undocumented" feature of windose and not the fault of the IDE.

Actually it isn't specifically Windoze, CR translates to 0x0D (13 in decimal) which is sometimes translated as CTRL + M (13th char in the alphabet). My guess is that IDE is using built-in accelerator handling (e.g. Visual Studio) and therefore have no control over the situation. They could just add in special key-handling in 10-20 lines of code for this particular case.... or as already suggested: [u]change the hotkey[/u] $)

Either way, it's still the responsibility of the IDE to pick hotkeys that won't have unintended side-effects, that's why I labeled this as a bug. There is great potential here to destroy your code, if you have a block of text selected and press the hotkey. Personally I tend to leave my cursor somewhere in my code and that line of code is split into two, which is somewhat annoying, especially when you're a noob (like myself) and testing a lot.

They could also offer a method to change it, although that won't help people who don't dig around their IDE configuration, plus it would require quite a bit more work than both solutions offered above.

Carriage Return (CR) = 0x0D = CHR(13) = CTRL+M. All are different ways of representing the same thing.

It is already reported here: http://code.google.com/p/arduino/issues/detail?id=279

And I wrote a patch recently for it that's available here, hope it'll be included in the official version soon: https://github.com/arduino/Arduino/pull/64