On 1/4/22 6:10 AM, Leah Neukirchen wrote: > Hi, > > I first thought I found a bug in rlwrap[1], but we traced it down to > readline. When "enable-bracketed-paste" is on (default as of 8.1), > an empty line is printed when readline() gets EOF.
Yes. More precisely, readline outputs "\n" after outputting the escape sequence to turn off bracketed paste mode. That escape sequence ends with "\r" to work around an issue with the Linux terminal driver that causes it to become confused about the physical cursor location. That leaves the cursor in column 0. (The discussion that prompted that change is interesting: https://lists.gnu.org/archive/html/bug-bash/2018-01/msg00097.html .) Once the cursor is in column 0, and the EOF (presumably) causes the process to exit, the cursor is still on the same line as when readline got EOF. To avoid overwriting any of the text on that line, readline outputs a newline, which moves the cursor to the next physical line. https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=903936 discusses that phenomenon. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, UTech, CWRU [email protected] http://tiswww.cwru.edu/~chet/
