public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Assume "unknown" terminal type by default
@ 2020-06-02  3:52 Stephanos Ioannidis
  2020-06-02 15:22 ` Eli Zaretskii
  2020-06-15 14:07 ` Tom Tromey
  0 siblings, 2 replies; 5+ messages in thread
From: Stephanos Ioannidis @ 2020-06-02  3:52 UTC (permalink / raw)
  To: gdb-patches; +Cc: Stephanos Ioannidis

This patch modifies the `_rl_init_terminal_io` function to pass
`unknown` terminal type instead of `dumb` when no terminal name is
provided by the caller (e.g. when the `TERM` environment variable is
not set on Win32).

This ensures that the termcap provider (e.g. ncurses) resolves the
default preferred terminal type instead of using the `dumb` terminal
type.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
---
 readline/readline/terminal.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/readline/readline/terminal.c b/readline/readline/terminal.c
index e557389776..086211d408 100644
--- a/readline/readline/terminal.c
+++ b/readline/readline/terminal.c
@@ -444,7 +444,7 @@ _rl_init_terminal_io (const char *terminal_name)
   tty = rl_instream ? fileno (rl_instream) : 0;
 
   if (term == 0)
-    term = "dumb";
+    term = "unknown";
 
 #ifdef __MSDOS__
   _rl_term_im = _rl_term_ei = _rl_term_ic = _rl_term_IC = (char *)NULL;
-- 
2.26.2


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Assume "unknown" terminal type by default
  2020-06-02  3:52 [PATCH] Assume "unknown" terminal type by default Stephanos Ioannidis
@ 2020-06-02 15:22 ` Eli Zaretskii
  2020-06-02 16:15   ` Stephanos Ioannidis
       [not found]   ` <SLXP216MB0285D95A8DA9B4C0AB87C6D8BD8B0@SLXP216MB0285.KORP216.PROD.OUTLOOK.COM>
  2020-06-15 14:07 ` Tom Tromey
  1 sibling, 2 replies; 5+ messages in thread
From: Eli Zaretskii @ 2020-06-02 15:22 UTC (permalink / raw)
  To: Stephanos Ioannidis; +Cc: gdb-patches

> From: Stephanos Ioannidis <root@stephanos.io>
> Date: Tue,  2 Jun 2020 12:52:49 +0900
> Cc: Stephanos Ioannidis <root@stephanos.io>
> 
> This patch modifies the `_rl_init_terminal_io` function to pass
> `unknown` terminal type instead of `dumb` when no terminal name is
> provided by the caller (e.g. when the `TERM` environment variable is
> not set on Win32).
> 
> This ensures that the termcap provider (e.g. ncurses) resolves the
> default preferred terminal type instead of using the `dumb` terminal
> type.

Isn't this something that ncurses itself should do on MS-Windows?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH] Assume "unknown" terminal type by default
  2020-06-02 15:22 ` Eli Zaretskii
@ 2020-06-02 16:15   ` Stephanos Ioannidis
       [not found]   ` <SLXP216MB0285D95A8DA9B4C0AB87C6D8BD8B0@SLXP216MB0285.KORP216.PROD.OUTLOOK.COM>
  1 sibling, 0 replies; 5+ messages in thread
From: Stephanos Ioannidis @ 2020-06-02 16:15 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: gdb-patches

> Isn't this something that ncurses itself should do on MS-Windows?

ncurses assumes the "#win32con" terminal type (required for proper terminal 
operation on the Windows console) when the tgetent is called with 
termtype=NULL or termtype="unknown".

In this case, _rl_init_terminal_io is passing termtype="dumb" to tgetent when 
the TERM environment variable is not defined, so ncurses is resolving the 
"dumb" terminal type instead of required "#win32con".

This effectively causes some keys (e.g. backspace and arrow keys) to not work 
in the gdb command line, and this patch ensures that the problem is fixed.

p.s. I apologise for the horrible line formatting in the previous messages; I
 am sending these from a home machine and the mail client settings are all
 messed up.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Assume "unknown" terminal type by default
       [not found]   ` <SLXP216MB0285D95A8DA9B4C0AB87C6D8BD8B0@SLXP216MB0285.KORP216.PROD.OUTLOOK.COM>
@ 2020-06-02 16:18     ` Eli Zaretskii
  0 siblings, 0 replies; 5+ messages in thread
From: Eli Zaretskii @ 2020-06-02 16:18 UTC (permalink / raw)
  To: Stephanos Ioannidis; +Cc: gdb-patches

[Please keep the mailing list on the CC.]

> From: Stephanos Ioannidis <root@stephanos.io>
> Date: Tue, 2 Jun 2020 16:03:27 +0000
> 
> > Isn't this something that ncurses itself should do on MS-Windows?
> 
> ncurses assumes the "#win32con" terminal type (required for proper terminal
> operation on the Windows console) when the tgetent is called with
> termtype=NULL or termtype="unknown".
> 
> In this case, _rl_init_terminal_io is passing termtype="dumb" to tgetent
> when the TERM environment variable is not defined, so ncurses is resolving
> the "dumb" terminal type instead of required "#win32con".
> 
> This effectively causes some keys (e.g. backspace and arrow keys) to not
> work in the gdb command line, and this patch ensures that the problem is
> fixed.

Ah, okay, I guess you are using a newer version of ncurses than I do.
(In my version ncurses only looks at $TERM.)

Thanks.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Assume "unknown" terminal type by default
  2020-06-02  3:52 [PATCH] Assume "unknown" terminal type by default Stephanos Ioannidis
  2020-06-02 15:22 ` Eli Zaretskii
@ 2020-06-15 14:07 ` Tom Tromey
  1 sibling, 0 replies; 5+ messages in thread
From: Tom Tromey @ 2020-06-15 14:07 UTC (permalink / raw)
  To: Stephanos Ioannidis; +Cc: gdb-patches

>>>>> "Stephanos" == Stephanos Ioannidis <root@stephanos.io> writes:

Stephanos> This patch modifies the `_rl_init_terminal_io` function to pass
Stephanos> `unknown` terminal type instead of `dumb` when no terminal name is
Stephanos> provided by the caller (e.g. when the `TERM` environment variable is
Stephanos> not set on Win32).

Stephanos> This ensures that the termcap provider (e.g. ncurses) resolves the
Stephanos> default preferred terminal type instead of using the `dumb` terminal
Stephanos> type.

Stephanos> Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
Stephanos> ---
Stephanos>  readline/readline/terminal.c | 2 +-
Stephanos>  1 file changed, 1 insertion(+), 1 deletion(-)

Patches to readline should normally go to the readline maintainer first.
I'd prefer we not diverge from upstream unless it is truly necessary.
If he accepts the patch, we can check it in locally.

thanks,
Tom

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-06-15 14:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-02  3:52 [PATCH] Assume "unknown" terminal type by default Stephanos Ioannidis
2020-06-02 15:22 ` Eli Zaretskii
2020-06-02 16:15   ` Stephanos Ioannidis
     [not found]   ` <SLXP216MB0285D95A8DA9B4C0AB87C6D8BD8B0@SLXP216MB0285.KORP216.PROD.OUTLOOK.COM>
2020-06-02 16:18     ` Eli Zaretskii
2020-06-15 14:07 ` Tom Tromey

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 read-only IMAP folder(s) and NNTP newsgroup(s).