philburk / pforth

Portable Forth in C
BSD Zero Clause License
598 stars 99 forks source link

no echo when user types (cross-compiled for MIPS big-endian running OpenWRT) #87

Closed jpellegrini closed 2 years ago

jpellegrini commented 3 years ago

I have made an (unofficial) package of PForth for OpenWRT (see #86 ). PForth runs fine, but without echoing input when the user types (the line is echoed at once when I type return). This is strange because I remember having seeing in the source that PForth flushes the output after each char (or am I wrong?)

philburk commented 2 years ago

pForth should definitely echo each character as it is typed. It seems like the Terminal is configured to cache output until a newline.

This might be worth a try in your terminal initialization code in sdTerminalInit in pf_io_posix.c:

setvbuf(stdout, nullptr, _IONBF, (size_t) 0);

You can also try:

ECHO ON

but I suspect it will not help.

jpellegrini commented 2 years ago

Calling setvbuf fixes it! Thank you! :smiley:

Is this something you'd be changing in pforth? Because if not, I can keep a patch with my OpenWRT packages, no problem.