[Gambas-devel] BUG: Recent changes to TerminalView stop you from responding to certain prompts

Tony Morehen tmorehen at ...755...
Tue Aug 29 06:48:28 CEST 2017


I did some more research into this issue and it seems related to what 
mode the tty is in.  There is canonical mode, which is the standard mode 
using readline ie with line editing and, it seems, CR to NL 
translation.  The other mode is raw mode, where keyboard input is sent 
directly to the application.  The read command uses raw mode.

So I tried experimenting with stty.  stty raw gave me the step effect on 
output but the enter keypress appeared to behave normally ie.  stty -raw 
fixed the step effect but then I found that enter now worked in the full 
screen cli text editors, read, and password prompts!  A work-around for 
this issue.

It turns out that stty raw is not symmetric.  Further experimenting 
showed that sending stty icrnl to the terminal on initialization fixes 
the enter bug.

This suggests that adding a property such as EnableCRtoNL to 
Process.term could be a good approach for a long-term fix. EnableCRtoNL 
would toggle a flag in the termios structure related to Process.term.


On 2017-08-28 11:50 AM, Tony Morehen wrote:
> Mea Culpa.
>
> We need to revert this change.
>
> While the fix I proposed did fix read and git's username/password 
> prompts, it broke several terminal-based text editors: nano, joe and 
> micro were the one's I tested.  For the editors, you now need to press 
> ctrl-M to get a new line.  Emacs though works fine.
>
> As far as read and git are concerned, you can press ctrl-J to get a 
> new line.  As well "read -e" will accept ctrl-M as new line.
>
> Obviously, there is no simple fix.  TerminalView needs to detect 
> whether the application is expecting keyboard input and so will work 
> only with ctrl-M or file-type input (ctrl-J).  I'll follow up on this.
>
> Sorry for the mess.
> Tony
>
>
> On 2017-08-25 05:10 PM, Benoît Minisini wrote:
>> Le 25/08/2017 à 22:32, Tony Morehen a écrit :
>>> When using terminalview in a terminal program, you cannot respond to 
>>> prompts such as git's requests for username and password. Bash's 
>>> built-in read command also doesn't work properly.  You can type in 
>>> text ok, but when you press enter, all you see is "^M" and nothing 
>>> happens. All you can do is press control-C to abort.
>>>
>>> To duplicate:
>>> 1) run FTerminalView in gb.form.terminal
>>> 2) enter "read -p '>'
>>> 3) type some text, press enter
>>> 4) all you see is your text + ^M
>>>
>>> Potential fix:
>>>
>>> line 673 in TerminalFilter_VT100, change the False action of the IIf 
>>> from "\r" to "\n"
>>>
>>> gb.form.terminal must be driving you guys nuts.
>>>
>>> Cheers,
>>> Tony
>>>
>>
>> OK, fixed.
>>
>
>
>
> ------------------------------------------------------------------------------ 
>
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Gambas-devel mailing list
> Gambas-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-devel






More information about the Devel mailing list