From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: master e91848344e: Pass through caret position from native GTK Date: Sun, 09 Jan 2022 19:07:52 +0200 Message-ID: <83sftwalcn.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="34620"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Po Lu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Jan 09 18:16:19 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n6bnm-0008mS-Jt for ged-emacs-devel@m.gmane-mx.org; Sun, 09 Jan 2022 18:16:18 +0100 Original-Received: from localhost ([::1]:43248 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n6bnl-0004KL-Jv for ged-emacs-devel@m.gmane-mx.org; Sun, 09 Jan 2022 12:16:17 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:60212) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n6bfs-0007m5-2J for emacs-devel@gnu.org; Sun, 09 Jan 2022 12:08:09 -0500 Original-Received: from [2001:470:142:3::e] (port=56544 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n6bfq-0005ar-HY; Sun, 09 Jan 2022 12:08:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=Subject:To:From:Date:mime-version:in-reply-to: references; bh=HF/wljqz9eVRlYL+aXDEnuokD2t86i5/PAGHJyMMR9o=; b=F4JHGtAT6/SzdC h9Fu/aQ7/EFYey3Ek/qQ8Gjt5iJNVsAsDE9j5wKGfHWRnI3KowmlqV9h5326tSSe9fVosSZZTnaJl O2wTjyJ8eVftb+8rTUmKIeUzmt9PS37Okxzyor4B7qGmTUUDvcnbF1lyblTgSq5AbCEjnfGSGgamp RH/YgzkCGWErqkgm+yIr1IDYu9K4ISM8d5JrGOAusY5qJm9AUqJAFAk7y0ufsx/lue55zjdKakESp M8txpjse84h1HP7X/No/TKSPlvedJoQ4Z6k2ZdKCl/SBbNcRWSmRRz/16kDQn5qILNHqzjhB2icQ1 xxRTdru87x4QFgvYVvIQ==; Original-Received: from [87.69.77.57] (port=4520 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n6bfq-00018T-FH; Sun, 09 Jan 2022 12:08:06 -0500 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:284505 Archived-At: > --- a/src/gtkutil.c > +++ b/src/gtkutil.c > @@ -6089,6 +6089,13 @@ xg_im_context_preedit_changed (GtkIMContext *imc, gpointer user_data) > EVENT_INIT (inev); > inev.kind = PREEDIT_TEXT_EVENT; > inev.arg = build_string_from_utf8 (str); > + > + Fput_text_property (make_fixnum (min (SCHARS (inev.arg), <<<<<<<<<<<< > + max (0, cursor))), > + make_fixnum (min (SCHARS (inev.arg), > + max (0, cursor) + 1)), > + Qcursor, Qt, inev.arg); Is it really correct to use SCHARS in the first argument to Fput_text_property? It should be SCHARS(..)-1, I think, as the characters in a string are indexed zero-based. (There are several places in this commit where I spotted the same code.) Thanks.