The Swift REPL fails to display certain characters on some terminals (for example, Ubuntu 20.04 is affected, but not Ubuntu 18.04). After the first line, some characters will simply not show up (like colons and braces), although they are inputted. Backspaces will also fail to clear any characters.
I haven't found the root cause, but I did find a possible fix for it.
Editline::ConfigureEditor has an early return:
if (m_editline && m_multiline_enabled == multiline) return;
The early return is taken every time except for the first call, and removing it actually fixes the issue. One possibility is that this function assumes that no other part of the code will change the configuration, but this assumption is being violated somewhere else. Since this issue doesn't affect all Linux terminals, another possibility is that the bug is on the terminal side and not LLDB (the fact that Ubuntu 18.04 works, but Ubuntu 20.04 doesn't, is an indicator this might be the case IMO).
I have no experience with this EditLine API though, so I'm unable to determine if the bug is in LLDB or not. And in the case it is, don't know what to look for and how to "properly" fix the issue.
Before pursuing a second solution though, I'd like to check with you guys if removing the early return is acceptable or not. If we come to the conclusion that the bug is not on LLDB's side, removing the early return on Linux only might be an acceptable solution? In the case that it isn't, could anyone help me figure out what could possibly be messing with the configuration?