Hi everyone,
in a past version of the Arduino IDE, pressing enter in the serial monitor edit box appended a newline to the string sent to the serial port. This was removed in version 0006, so that pressing enter only sends the characters entered in the edit box. I don't know the rationale behind this decision (or whether there exists another way of sending a newline), but in my case i really need to send "\r\n" to some of my boards.
So i would like to propose the following patch. It changes the behavior of the key listener, so that pressing enter alone appends "\r\n" and pressing enter+ctrl doesn't.
Index: app/EditorStatus.java
===================================================================
--- app/EditorStatus.java (revision 472)
+++ app/EditorStatus.java (working copy)
@@ -421,6 +421,10 @@
if (c == KeyEvent.VK_ENTER) { // accept the input
editor.serialPort.write(serialField.getText());
+ if ((event.getModifiersEx () & KeyEvent.CTRL_DOWN_MASK) == 0)
+ {
+ editor.serialPort.write("\r\n");
+ }
event.consume();
serialField.setText("");
}
This could be enhanced even more, if the modifier key and whether to send "\n" or "\r\n" could be specified through the preferences.