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

Re: unget a character



On Feb 5,  8:53pm, rahul wrote:
} 
} How can i unget a character (taken in by read -k).
} 
} It would help me if i could unget a char in one part of my app, so it will
} be available in the main loop.

If you are talking about an interactive shell reading input with ZLE, you
can do it with "zle -U".

If you're in some other way reading from a stream such as standard input,
unget is not possible.  You need a lower-level programming language with
more direct control over things like stdio buffers.  (Unget is not an OS-
level operation, it's implemented in stdio or the equivalent.)



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