We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c8df99e commit 81ba0abCopy full SHA for 81ba0ab
src/arduino/arduino.ts
@@ -756,15 +756,18 @@ export class ArduinoApp {
756
// Wrap line-oriented callbacks to accept arbitrary chunks of data.
757
const wrapLineCallback = (callback: (line: string) => void) => {
758
let buffer = "";
759
+ let startIndex = 0;
760
return (data: string) => {
761
buffer += data;
- for (;;) {
762
- const pos = buffer.indexOf(os.EOL);
+ while (true) {
763
+ const pos = buffer.indexOf(os.EOL, startIndex);
764
if (pos < 0) {
765
+ startIndex = buffer.length;
766
break;
767
}
768
const line = buffer.substring(0, pos + os.EOL.length);
769
buffer = buffer.substring(pos + os.EOL.length);
770
+ startIndex = 0;
771
callback(line);
772
773
};
0 commit comments