unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: master e91848344e: Pass through caret position from native GTK
@ 2022-01-09 17:07 Eli Zaretskii
  2022-01-10  0:27 ` Po Lu
  0 siblings, 1 reply; 2+ messages in thread
From: Eli Zaretskii @ 2022-01-09 17:07 UTC (permalink / raw)
  To: Po Lu; +Cc: emacs-devel

> --- 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.



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

* Re: master e91848344e: Pass through caret position from native GTK
  2022-01-09 17:07 master e91848344e: Pass through caret position from native GTK Eli Zaretskii
@ 2022-01-10  0:27 ` Po Lu
  0 siblings, 0 replies; 2+ messages in thread
From: Po Lu @ 2022-01-10  0:27 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

> 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.

Good catch, thanks.



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

end of thread, other threads:[~2022-01-10  0:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-09 17:07 master e91848344e: Pass through caret position from native GTK Eli Zaretskii
2022-01-10  0:27 ` Po Lu

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).