From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by sourceware.org (Postfix) with ESMTPS id C83B93858C2C for ; Fri, 26 May 2023 15:44:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C83B93858C2C Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de Received: from imap1.suse-dmz.suse.de (imap1.suse-dmz.suse.de [192.168.254.73]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 0E5CA21959; Fri, 26 May 2023 15:44:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1685115857; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eX/OwEWOj3xS4OeNK1/BQ+8Vm75ZodTITYZUd8sbFkY=; b=KiORGzN4mCZLsk5Pb/Y/PhNAWO6McCUowoXQ09ggo9Auy4vFvNTSqacxMiUuWtGvvcy34q KbUbdhn0or30o58HBN5pb/7Hjyhhyn6nbv7Hoyb2DDHK1yOTjQZYaF7yCWpm4hA7QdefNX CF46A07PDlvyjGUORJAyHl80Tj3q8wI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1685115857; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eX/OwEWOj3xS4OeNK1/BQ+8Vm75ZodTITYZUd8sbFkY=; b=XMnlGSmHQQ2l9QhZSYKmtF4263s87ZvzsbNb121thJ6t/RA6096Bttn9qE/1M4Nl0aIKCj rlBHoeYB8hDFtTCw== Received: from imap1.suse-dmz.suse.de (imap1.suse-dmz.suse.de [192.168.254.73]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap1.suse-dmz.suse.de (Postfix) with ESMTPS id E7A4F134AB; Fri, 26 May 2023 15:44:16 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap1.suse-dmz.suse.de with ESMTPSA id u9KbNtDTcGQxDwAAGKfGzw (envelope-from ); Fri, 26 May 2023 15:44:16 +0000 Message-ID: <0c1512d8-0912-044d-6c12-ec93de068b87@suse.de> Date: Fri, 26 May 2023 17:44:29 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [PATCH] [gdb/tui] Handle unicode chars in prompt To: gdb-patches@sourceware.org Cc: Tom Tromey References: <20230526132512.29496-1-tdevries@suse.de> Content-Language: en-US From: Tom de Vries In-Reply-To: <20230526132512.29496-1-tdevries@suse.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 5/26/23 15:25, Tom de Vries via Gdb-patches wrote: > In TUI, the prompt is written out by tui_puts_internal, which outputs one byte > at a time using waddch, which apparantly breaks multi-byte char support. > > Fix this by detecting multi-byte chars in tui_puts_internal, and printing them using > waddnstr. FWIW, I just came across this commit, which seems relevant: ... commit 2c72d5e58a55d3e0f867ffd9421184852f051cb7 Author: Tom Tromey Date: Sun Sep 27 20:30:30 2020 -0600 Rewrite tui_puts This rewrites tui_puts. It now writes as many bytes as possible in a call to waddnstr, letting curses handle multi-byte sequences properly. Note that tui_puts_internal remains. It is needed to handle computing the start line of the readline prompt, which is difficult to do properly in the case where redisplaying can also cause the command window to scroll. This might be possible to implement by reverting to single "character" output, by using mbsrtowcs for its side effects to find character boundaries in the input. I have not attempted this. ... This patch uses mbrtowc rather than mbsrtowcs, but I suppose the idea is the same. Thanks, - Tom