From 401f6333ed18e0981a0c3fff2936e303d9e1fef3 Mon Sep 17 00:00:00 2001 From: David Baker Date: Thu, 25 Oct 2018 14:54:32 +0100 Subject: [PATCH] Do...while loops are a thing --- src/components/views/rooms/MessageComposerInput.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index 604c797fe4..792dcede8a 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -573,7 +573,7 @@ export default class MessageComposerInput extends React.Component { } // emojioneify any emoji - while (true) { + do { let foundEmoji = false; for (const node of editorState.document.getTexts()) { @@ -607,9 +607,7 @@ export default class MessageComposerInput extends React.Component { } } } - - if (!foundEmoji) break; - } + } while (foundEmoji); // work around weird bug where inserting emoji via the macOS // emoji picker can leave the selection stuck in the emoji's