GNU bug report logs - #7282
23.2; [PATCH] Improve text composition by Input Methods on MacOSX.

Previous Next

Package: emacs;

Reported by: Keitaro Miyazaki <keitaro.miyazaki <at> gmail.com>

Date: Tue, 26 Oct 2010 13:35:02 UTC

Severity: normal

Tags: patch

Done: Alan Third <alan <at> idiocy.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 7282 in the body.
You can then email your comments to 7282 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#7282; Package emacs. (Tue, 26 Oct 2010 13:35:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Keitaro Miyazaki <keitaro.miyazaki <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 26 Oct 2010 13:35:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Keitaro Miyazaki <keitaro.miyazaki <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 23.2; [PATCH] Improve text composition by Input Methods on MacOSX.
Date: Tue, 26 Oct 2010 21:20:13 +0900
[Message part 1 (text/plain, inline)]
It is quite difficult to compose "input text" of language
such as Japanese by Input Methods like "Kotoeri" on MacOSX,
because emacs does not show clause boundary of the "input text".

I made an attached patch which improves text composition
by making a highlight on active clause of the "input text".

See also attached screen shots which shows effect of this patch:

  before.png: Before applying this patch,
              no clause boundary is shown.

  after.png:  After applying this patch,
              clause boundaries are indicated by
              a highlight on active clause.


In GNU Emacs 23.2.1 (x86_64-apple-darwin10.4.0, NS apple-appkit-1038.32)
 of 2010-10-26 on mac
Windowing system distributor `Apple', version 10.3.1038
configured using `configure  '--with-ns''
[before.png (image/png, attachment)]
[after.png (image/png, attachment)]
[highlight-on-active-clause.diff (application/octet-stream, attachment)]

Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#7282; Package emacs. (Wed, 27 Oct 2010 05:43:02 GMT) Full text and rfc822 format available.

Message #8 received at 7282 <at> debbugs.gnu.org (full text, mbox):

From: YAMAMOTO Mitsuharu <mituharu <at> math.s.chiba-u.ac.jp>
To: Keitaro Miyazaki <keitaro.miyazaki <at> gmail.com>
Cc: 7282 <at> debbugs.gnu.org
Subject: Re: bug#7282: 23.2;
	[PATCH] Improve text composition by Input Methods on MacOSX.
Date: Wed, 27 Oct 2010 14:46:56 +0900
>>>>> On Tue, 26 Oct 2010 21:20:13 +0900, Keitaro Miyazaki <keitaro.miyazaki <at> gmail.com> said:

> It is quite difficult to compose "input text" of language such as
> Japanese by Input Methods like "Kotoeri" on MacOSX, because emacs
> does not show clause boundary of the "input text".

> I made an attached patch which improves text composition by making a
> highlight on active clause of the "input text".

The members in `selRange' are in UTF-16 indices.  So they are not
necessarily coincide with character indices when the marked text
contains non-BMP characters.

				     YAMAMOTO Mitsuharu
				mituharu <at> math.s.chiba-u.ac.jp




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#7282; Package emacs. (Wed, 27 Oct 2010 06:14:02 GMT) Full text and rfc822 format available.

Message #11 received at 7282 <at> debbugs.gnu.org (full text, mbox):

From: YAMAMOTO Mitsuharu <mituharu <at> math.s.chiba-u.ac.jp>
To: Keitaro Miyazaki <keitaro.miyazaki <at> gmail.com>
Cc: 7282 <at> debbugs.gnu.org
Subject: Re: bug#7282: 23.2;
	[PATCH] Improve text composition by Input Methods on MacOSX.
Date: Wed, 27 Oct 2010 15:17:02 +0900
>>>>> On Wed, 27 Oct 2010 14:46:56 +0900, YAMAMOTO Mitsuharu <mituharu <at> math.s.chiba-u.ac.jp> said:

> The members in `selRange' are in UTF-16 indices.  So they are not

Oops, "they do not"...

> necessarily coincide with character indices when the marked text
> contains non-BMP characters.

				     YAMAMOTO Mitsuharu
				mituharu <at> math.s.chiba-u.ac.jp




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#7282; Package emacs. (Wed, 27 Oct 2010 14:53:02 GMT) Full text and rfc822 format available.

Message #14 received at 7282 <at> debbugs.gnu.org (full text, mbox):

From: Keitaro Miyazaki <keitaro.miyazaki <at> gmail.com>
To: YAMAMOTO Mitsuharu <mituharu <at> math.s.chiba-u.ac.jp>
Cc: 7282 <at> debbugs.gnu.org
Subject: Re: bug#7282: 23.2; [PATCH] Improve text composition by Input Methods
	on MacOSX.
Date: Wed, 27 Oct 2010 23:56:47 +0900
Yes, NSString counts length of string as number of Unicode characters,
and I suppose range is counted in a similar way.

     "... The length method returns the total number of Unicode
characters in the string ..."

       NSString Class Reference
       <http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/Reference/NSString.html>




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#7282; Package emacs. (Thu, 28 Oct 2010 00:52:02 GMT) Full text and rfc822 format available.

Message #17 received at 7282 <at> debbugs.gnu.org (full text, mbox):

From: YAMAMOTO Mitsuharu <mituharu <at> math.s.chiba-u.ac.jp>
To: Keitaro Miyazaki <keitaro.miyazaki <at> gmail.com>
Cc: 7282 <at> debbugs.gnu.org, YAMAMOTO Mitsuharu <mituharu <at> math.s.chiba-u.ac.jp>
Subject: Re: bug#7282: 23.2;
	[PATCH] Improve text composition by Input Methods on MacOSX.
Date: Thu, 28 Oct 2010 09:55:37 +0900
[Message part 1 (text/plain, inline)]
>>>>> On Wed, 27 Oct 2010 23:56:47 +0900, Keitaro Miyazaki <keitaro.miyazaki <at> gmail.com> said:

> Yes, NSString counts length of string as number of Unicode characters,
> and I suppose range is counted in a similar way.

>      "... The length method returns the total number of Unicode
> characters in the string ..."

>        NSString Class Reference
>        <http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/Reference/NSString.html>

In this context, "number of Unicode characters" should be read as
"number of `unichar' values", where the type `unichar' is of 16-bit
width.  Actually, it is confusing.

Also, selected range handling is not enough for the following case:

  (activate Kotoeri) a i u e o left left left

The first screenshot is for the NS port with your patch, and the
second one is for my Mac port
(http://lists.gnu.org/archive/html/emacs-devel/2010-09/msg01439.html).

				     YAMAMOTO Mitsuharu
				mituharu <at> math.s.chiba-u.ac.jp
[ns_port.png (image/png, inline)]
[mac_port.png (image/png, inline)]

Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#7282; Package emacs. (Thu, 28 Oct 2010 06:12:02 GMT) Full text and rfc822 format available.

Message #20 received at 7282 <at> debbugs.gnu.org (full text, mbox):

From: Keitaro Miyazaki <keitaro.miyazaki <at> gmail.com>
To: YAMAMOTO Mitsuharu <mituharu <at> math.s.chiba-u.ac.jp>
Cc: 7282 <at> debbugs.gnu.org
Subject: Re: bug#7282: 23.2; [PATCH] Improve text composition by Input Methods
	on MacOSX.
Date: Thu, 28 Oct 2010 15:15:54 +0900
[Message part 1 (text/plain, inline)]
Do you mean that there are some cases that the number of characters in
a string, in other words, the length of a string, is different from
the one counted by NSString to the one counted by Emacs?

If so, could you show me any example of these cases?


> Also, selected range handling is not enough for the following case:

Thank you for pointing that out.
I made an attached patch which may fix this problem
by moving cursor in composing text.

Apply this patch after applying my previous patch.
[im-cursor-position-fix.diff (application/octet-stream, attachment)]

Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#7282; Package emacs. (Thu, 28 Oct 2010 06:32:02 GMT) Full text and rfc822 format available.

Message #23 received at 7282 <at> debbugs.gnu.org (full text, mbox):

From: YAMAMOTO Mitsuharu <mituharu <at> math.s.chiba-u.ac.jp>
To: Keitaro Miyazaki <keitaro.miyazaki <at> gmail.com>
Cc: 7282 <at> debbugs.gnu.org, YAMAMOTO Mitsuharu <mituharu <at> math.s.chiba-u.ac.jp>
Subject: Re: bug#7282: 23.2;
	[PATCH] Improve text composition by Input Methods on MacOSX.
Date: Thu, 28 Oct 2010 15:35:38 +0900
>>>>> On Thu, 28 Oct 2010 15:15:54 +0900, Keitaro Miyazaki <keitaro.miyazaki <at> gmail.com> said:

> Do you mean that there are some cases that the number of characters
> in a string, in other words, the length of a string, is different
> from the one counted by NSString to the one counted by Emacs?

> If so, could you show me any example of these cases?

I mentioned "non-BMP characters" in the previous reply.

(mapcar 'length (list (string #xffff) (string #x10000)))

=> (1 1)

#import <Cocoa/Cocoa.h>
#include <stdio.h>

main()
{
  NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
  const char str1[] = {0xef, 0xbf, 0xbf, '\0'}; // U+ffff in UTF-8
  const char str2[] = {0xf0, 0x90, 0x80, 0x80, '\0'}; // U+10000 in UTF-8
  NSString *string1 = [NSString stringWithUTF8String:str1];
  NSString *string2 = [NSString stringWithUTF8String:str2];

  printf ("%ld %ld\n", [string1 length], [string2 length]);
  [pool release];
}

=> 1 2

				     YAMAMOTO Mitsuharu
				mituharu <at> math.s.chiba-u.ac.jp




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#7282; Package emacs. (Thu, 28 Oct 2010 15:28:02 GMT) Full text and rfc822 format available.

Message #26 received at 7282 <at> debbugs.gnu.org (full text, mbox):

From: Keitaro Miyazaki <keitaro.miyazaki <at> gmail.com>
To: YAMAMOTO Mitsuharu <mituharu <at> math.s.chiba-u.ac.jp>
Cc: 7282 <at> debbugs.gnu.org
Subject: Re: bug#7282: 23.2; [PATCH] Improve text composition by Input Methods
	on MacOSX.
Date: Fri, 29 Oct 2010 00:31:09 +0900
[Message part 1 (text/plain, inline)]
> I mentioned "non-BMP characters" in the previous reply.

I understood that NSString counts numbers of UTF-16 units
instead of numbers of characters, so NSString counts length
of a non-BMP character as 2.

Thanks for your detailed description.


I fixed my patch to adjust the numbers in `selectedRange',
so that emacs can recognize the range properly.

Attached patch also includes the patch `im-cursor-position-fix.diff',
so you don't need to apply it now.


...BTW, I tried your Mac port today, and it seems to be working
fine for me. I hope it will be merged soon.
[highlight-on-active-clause-v2.diff (application/octet-stream, attachment)]

bug reassigned from package 'emacs' to 'ns'. Request was from Lars Magne Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Wed, 11 Apr 2012 11:21:02 GMT) Full text and rfc822 format available.

bug No longer marked as found in versions 23.2. Request was from Lars Magne Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Wed, 11 Apr 2012 11:21:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#7282; Package emacs. (Sun, 10 Jul 2016 15:17:01 GMT) Full text and rfc822 format available.

Message #33 received at 7282 <at> debbugs.gnu.org (full text, mbox):

From: Alan Third <alan <at> idiocy.org>
To: Keitaro Miyazaki <keitaro.miyazaki <at> gmail.com>
Cc: 7282 <at> debbugs.gnu.org, YAMAMOTO Mitsuharu <mituharu <at> math.s.chiba-u.ac.jp>
Subject: Re: bug#7282: 23.2;
 [PATCH] Improve text composition by Input Methods on MacOSX.
Date: Sun, 10 Jul 2016 16:15:57 +0100
Keitaro Miyazaki <keitaro.miyazaki <at> gmail.com> writes:
> It is quite difficult to compose "input text" of language
> such as Japanese by Input Methods like "Kotoeri" on MacOSX,
> because emacs does not show clause boundary of the "input text".

> I fixed my patch to adjust the numbers in `selectedRange',
> so that emacs can recognize the range properly.
>
> Attached patch also includes the patch `im-cursor-position-fix.diff',
> so you don't need to apply it now.

Can anyone confirm whether this is still an issue?

The patch no longer cleanly applies, but it looks like it might be
easily fixable.
-- 
Alan Third




Reply sent to Alan Third <alan <at> idiocy.org>:
You have taken responsibility. (Wed, 27 Dec 2017 00:16:02 GMT) Full text and rfc822 format available.

Notification sent to Keitaro Miyazaki <keitaro.miyazaki <at> gmail.com>:
bug acknowledged by developer. (Wed, 27 Dec 2017 00:16:02 GMT) Full text and rfc822 format available.

Message #38 received at 7282-done <at> debbugs.gnu.org (full text, mbox):

From: Alan Third <alan <at> idiocy.org>
To: Keitaro Miyazaki <keitaro.miyazaki <at> gmail.com>
Cc: 7282-done <at> debbugs.gnu.org
Subject: Re: bug#7282: 23.2;
 [PATCH] Improve text composition by Input Methods on MacOSX.
Date: Wed, 27 Dec 2017 00:14:58 +0000
Alan Third <alan <at> idiocy.org> writes:

> Keitaro Miyazaki <keitaro.miyazaki <at> gmail.com> writes:
> Can anyone confirm whether this is still an issue?
>
> The patch no longer cleanly applies, but it looks like it might be
> easily fixable.

Looking at this again I just realised this was a bug for the Mac port.

Since it's no longer relevant to GNU Emacs, and nobody's responded in
over a year, I'm going to close it.
-- 
Alan Third




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 24 Jan 2018 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 7 years and 151 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.