* This is probably known and wont-fix: zpty -w always adds a new line @ 2018-11-07 11:31 ` Sebastian Gniazdowski 2018-11-07 12:01 ` Peter Stephenson 0 siblings, 1 reply; 4+ messages in thread From: Sebastian Gniazdowski @ 2018-11-07 11:31 UTC (permalink / raw) To: Zsh hackers list Hello, according to man, zpty -w should add a new-line only if invoked with option -n. But the experience, e.g. the written command-line (to Src/zsh zpty process) always gets executed, even without -n – says a new-line is written also without -n. Also other proof, I have a function zpty_input (a modified W02jobs.ztst function) that if obtains string "nl" as $2, then it emits $'\n' after the input ($1; to in-zpty ran Src/zsh). Now, assuming zpty doesn't write new line without -n, I was using `nl' string after each command (not after \C-a key). The effect: number of Zle-echoed-back lines (again, the zpty process is Src/zsh with Zle active) was doubled, i.e. I was receiving my sent commands (correct, $'\n'-ended) and the same number of empty lines. Conclusion: my `nl' / $'\n' new-line was followed by zpty -w new-line and this resulted in an empty line after each zpty -w. Removing my `nl' allows to read normal, not doubled number of echoed-back lines, which results in a less-hacky or tricky impression when reading the code. I guess this is a wont-fix and maybe even something known. Projects zsh-async and zsh-autosuggestions are using `zpty' and changing the current behavior would cause problems for them. That said, it's now impossible to e.g. just enter a text at zpty/zsh command-line and do nothing. -- Sebastian Gniazdowski News: https://twitter.com/ZdharmaI IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin Blog: http://zdharma.org ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: This is probably known and wont-fix: zpty -w always adds a new line 2018-11-07 11:31 ` This is probably known and wont-fix: zpty -w always adds a new line Sebastian Gniazdowski @ 2018-11-07 12:01 ` Peter Stephenson 2018-11-07 12:21 ` Sebastian Gniazdowski 2018-11-07 12:30 ` Peter Stephenson 0 siblings, 2 replies; 4+ messages in thread From: Peter Stephenson @ 2018-11-07 12:01 UTC (permalink / raw) To: zsh-workers On Wed, 2018-11-07 at 12:31 +0100, Sebastian Gniazdowski wrote: > Hello, > according to man, zpty -w should add a new-line only if invoked with > option -n. But the experience, e.g. the written command-line (to > Src/zsh zpty process) always gets executed, even without -n – says a > new-line is written also without -n. It's the other way round: If the tt(-n) option is em(not) given, a newline is added at the end. Can't see anything obviously wrong with the trivial implementation for this. If you don't give a write argument to zpty -w, so it's getting it from reading stdin, it'll ignore the -n argument, but that's probably obvious. pws ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: This is probably known and wont-fix: zpty -w always adds a new line 2018-11-07 12:01 ` Peter Stephenson @ 2018-11-07 12:21 ` Sebastian Gniazdowski 2018-11-07 12:30 ` Peter Stephenson 1 sibling, 0 replies; 4+ messages in thread From: Sebastian Gniazdowski @ 2018-11-07 12:21 UTC (permalink / raw) To: Peter Stephenson; +Cc: Zsh hackers list On Wed, 7 Nov 2018 at 13:09, Peter Stephenson <p.stephenson@samsung.com> wrote: > It's the other way round: > > If the tt(-n) option is em(not) given, a newline is added at the end. > > Can't see anything obviously wrong with the trivial implementation for > this. Ah! Thanks. > If you don't give a write argument to zpty -w, so it's getting it from > reading stdin, it'll ignore the -n argument, but that's probably > obvious. > > pws -- Sebastian Gniazdowski News: https://twitter.com/ZdharmaI IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin Blog: http://zdharma.org ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: This is probably known and wont-fix: zpty -w always adds a new line 2018-11-07 12:01 ` Peter Stephenson 2018-11-07 12:21 ` Sebastian Gniazdowski @ 2018-11-07 12:30 ` Peter Stephenson 1 sibling, 0 replies; 4+ messages in thread From: Peter Stephenson @ 2018-11-07 12:30 UTC (permalink / raw) To: zsh-workers On Wed, 2018-11-07 at 12:01 +0000, Peter Stephenson wrote: > If you don't give a write argument to zpty -w, so it's getting it from > reading stdin, it'll ignore the -n argument, but that's probably > obvious. While I'm here... pws diff --git a/Doc/Zsh/mod_zpty.yo b/Doc/Zsh/mod_zpty.yo index 44b375a..6f20c4b 100644 --- a/Doc/Zsh/mod_zpty.yo +++ b/Doc/Zsh/mod_zpty.yo @@ -41,7 +41,8 @@ em(not) given, a newline is added at the end. If no var(string) is provided, the standard input is copied to the pseudo-terminal; this may stop before copying the full input if the -pseudo-terminal is non-blocking. +pseudo-terminal is non-blocking. The exact input is always copied: +the tt(-n) option is not applied. Note that the command under the pseudo-terminal sees this input as if it were typed, so beware when sending special tty driver characters such as ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-11-07 12:30 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <CGME20181107113210epcas3p4cf89233ec2bbb8a604435389f5123845@epcas3p4.samsung.com> 2018-11-07 11:31 ` This is probably known and wont-fix: zpty -w always adds a new line Sebastian Gniazdowski 2018-11-07 12:01 ` Peter Stephenson 2018-11-07 12:21 ` Sebastian Gniazdowski 2018-11-07 12:30 ` Peter Stephenson
Code repositories for project(s) associated with this public inbox https://git.vuxu.org/mirror/zsh/ This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).