Pages: [1]   Go Down
Author Topic: Pressing enter within the serial monitor edit box  (Read 555 times)
0 Members and 1 Guest are viewing this topic.
Dortmund, NRW, Germany
Offline Offline
Karma: 0
Posts: 4
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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/
--- app/      (revision 472)
+++ app/      (working copy)
@@ -421,6 +421,10 @@
           if (c == KeyEvent.VK_ENTER) {  // accept the input
+              if ((event.getModifiersEx () & KeyEvent.CTRL_DOWN_MASK) == 0)
+              {
+                editor.serialPort.write("\r\n");
+              }
This could be enhanced even more, if the modifier key and whether to send  "\n" or "\r\n" could be specified through the preferences.
« Last Edit: August 09, 2008, 05:52:34 am by grapelabs » Logged

Pages: [1]   Go Up
Jump to: