Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

pws-18: Multiline cut'n'paste - second go.



Now Zsh correctly handles multiline input in *single* command (that is, with
PS2) - but not, when every line is a separate command.

Here is what you get when pasting more than one line (zsh in question is in
normal PS1 state):

bor@itsrm2:~%> truss -t read,write,ioctl -r 10 -w 10 -p 22812
read(10, 0x000000FFFFFEE7E4, 1) (sleeping...)
read(10, " c", 1)                               = 1
write(10, " c", 1)                              = 1
read(10, " o", 1)                               = 1
write(10, "\b c o", 3)                          = 3
read(10, " m", 1)                               = 1
write(10, " m", 1)                              = 1
read(10, " p", 1)                               = 1
write(10, " p", 1)                              = 1
read(10, " c", 1)                               = 1
write(10, " c", 1)                              = 1
read(10, " o", 1)                               = 1
write(10, " o", 1)                              = 1
read(10, " n", 1)                               = 1
write(10, " n", 1)                              = 1
read(10, " f", 1)                               = 1
write(10, " f", 1)                              = 1
read(10, "  ", 1)                               = 1
write(10, "  ", 1)                              = 1
read(10, " c", 1)                               = 1
write(10, " c", 1)                              = 1
read(10, " o", 1)                               = 1
write(10, " o", 1)                              = 1
read(10, " r", 1)                               = 1
write(10, " r", 1)                              = 1
read(10, " r", 1)                               = 1
write(10, " r", 1)                              = 1
read(10, " e", 1)                               = 1
write(10, " e", 1)                              = 1
read(10, " c", 1)                               = 1
write(10, " c", 1)                              = 1
read(10, " t", 1)                               = 1
write(10, " t", 1)                              = 1
read(10, " _", 1)                               = 1
write(10, " _", 1)                              = 1
read(10, " a", 1)                               = 1
write(10, " a", 1)                              = 1
read(10, " c", 1)                               = 1
write(10, " c", 1)                              = 1
read(10, " c", 1)                               = 1
write(10, " c", 1)                              = 1
read(10, " e", 1)                               = 1
write(10, " e", 1)                              = 1
read(10, " p", 1)                               = 1
write(10, " p", 1)                              = 1
read(10, " t", 1)                               = 1
write(10, " t", 1)                              = 1
read(10, " =", 1)                               = 1
write(10, " =", 1)                              = 1
read(10, " '", 1)                               = 1
write(10, " '", 1)                              = 1
read(10, " 2", 1)                               = 1
write(10, " 2", 1)                              = 1
read(10, " n", 1)                               = 1
write(10, " n", 1)                              = 1
read(10, " '", 1)                               = 1
write(10, " '", 1)                              = 1
read(10, "\n", 1)                               = 1
write(10, "\r\n", 2)                            = 2
ioctl(10, TCGETA, 0x000000FFFFFEEC6C)           = 0
ioctl(10, TCSETSW, 0x000000000050B1A8)          = 0
!!^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^!!

ioctl(0, I_FIND, "sockmod")                     = 0
ioctl(10, TIOCGSID, 0x000000FFFFFEECAC)         = 0
ioctl(10, TIOCSPGRP, 0x000000FFFFFEECF4)        = 0
ioctl(10, FIONREAD, 0x000000FFFFFEE7BC)         = 0
ioctl(10, TIOCGSID, 0x000000FFFFFEE6FC)         = 0
ioctl(10, TIOCSPGRP, 0x000000FFFFFEE744)        = 0
ioctl(10, TCGETA, 0x000000FFFFFEE6FC)           = 0
ioctl(10, TCSETSW, 0x000000FFFFFEE7C0)          = 0
write(10, 0x0000000000505EB0, 50)               = 50
  \r1B [ 0 m1B [ 2 2 ; 2 7 m1B [ 2 4 m1B [ J1B [ 2 ; 7 m b o r @ i
   t s r m 2 : ~ % >1B [ 2 2 ; 2 7 m
write(10, "1B [ K", 3)                          = 3
read(10, 0x000000FFFFFEE7E4, 1) (sleeping...)

As you see, we get TCSETSW *immediately* after NL was seen (and output).
That throughs away any pending input - so, following FIONREAD is a noop.

/andrej



Messages sorted by: Reverse Date, Date, Thread, Author