unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#7282: 23.2; [PATCH] Improve text composition by Input Methods on MacOSX.
@ 2010-10-26 12:20 Keitaro Miyazaki
  2010-10-27  5:46 ` YAMAMOTO Mitsuharu
  0 siblings, 1 reply; 10+ messages in thread
From: Keitaro Miyazaki @ 2010-10-26 12:20 UTC (permalink / raw)
  To: 7282

[-- Attachment #1: Type: text/plain, Size: 783 bytes --]

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

[-- Attachment #2: before.png --]
[-- Type: image/png, Size: 65339 bytes --]

[-- Attachment #3: after.png --]
[-- Type: image/png, Size: 65430 bytes --]

[-- Attachment #4: highlight-on-active-clause.diff --]
[-- Type: application/octet-stream, Size: 3773 bytes --]

diff -upr emacs-23.2.orig/lisp/term/ns-win.el emacs-23.2/lisp/term/ns-win.el
--- emacs-23.2.orig/lisp/term/ns-win.el	2010-04-04 07:26:08.000000000 +0900
+++ emacs-23.2/lisp/term/ns-win.el	2010-10-26 16:48:36.000000000 +0900
@@ -551,10 +551,19 @@ The properties returned may include `top
   "Face used to highlight working text during compose sequence insert."
   :group 'ns)
 
+(defface ns-active-clause-face
+  '((t :inherit ns-working-text-face :inverse-video t))
+  "Face used to highlight active clause of working text during compose sequence insert."
+  :group 'ns)
+
 (defvar ns-working-overlay nil
   "Overlay used to highlight working text during compose sequence insert.
 When text is in th echo area, this just stores the length of the working text.")
 
+(defvar ns-active-clause-overlay nil
+  "Overlay used to highlight active clause of working text during compose sequence insert.
+When text is in th echo area, this just stores the length of the working text.")
+
 (defvar ns-working-text)		; nsterm.m
 
 ;; Test if in echo area, based on mac-win.el 2007/08/26 unicode-2.
@@ -597,7 +606,12 @@ The overlay is assigned the face `ns-wor
     (insert ns-working-text)
     (overlay-put (setq ns-working-overlay (make-overlay start (point)
 							(current-buffer) nil t))
-		 'face 'ns-working-text-face)))
+		 'face 'ns-working-text-face)
+    (overlay-put (setq ns-active-clause-overlay
+                       (make-overlay (+ start (car ns-range-of-active-clause))
+                                     (+ start (cdr ns-range-of-active-clause))
+                                     nil t))
+                 'face 'ns-active-clause-face)))
 
 (defun ns-echo-working-text ()
   "Echo contents of `ns-working-text' in message display area.
@@ -622,7 +636,8 @@ See `ns-insert-working-text'."
     (with-current-buffer (overlay-buffer ns-working-overlay)
       (delete-region (overlay-start ns-working-overlay)
                      (overlay-end ns-working-overlay))
-      (delete-overlay ns-working-overlay)))
+      (delete-overlay ns-working-overlay)
+      (delete-overlay ns-active-clause-overlay)))
    ((integerp ns-working-overlay)
     (let ((msg (current-message))
           message-log-max)
diff -upr emacs-23.2.orig/src/nsterm.m emacs-23.2/src/nsterm.m
--- emacs-23.2.orig/src/nsterm.m	2010-04-04 07:26:04.000000000 +0900
+++ emacs-23.2/src/nsterm.m	2010-10-26 16:48:36.000000000 +0900
@@ -138,6 +138,7 @@ static unsigned convert_ns_to_X_keysym[]
 /* Lisp communications */
 Lisp_Object ns_input_file, ns_input_font, ns_input_fontsize, ns_input_line;
 Lisp_Object ns_input_color, ns_input_text, ns_working_text;
+Lisp_Object ns_range_of_active_clause;
 Lisp_Object ns_input_spi_name, ns_input_spi_arg;
 Lisp_Object Vx_toolkit_scroll_bars;
 static Lisp_Object Qmodifier_value;
@@ -4574,6 +4575,8 @@ ns_term_shutdown (int sig)
   processingCompose = YES;
   workingText = [str copy];
   ns_working_text = build_string ([workingText UTF8String]);
+  ns_range_of_active_clause = Fcons (make_number (selRange.location),
+                                     make_number (NSMaxRange (selRange)));
 
   emacs_event->kind = NS_TEXT_EVENT;
   emacs_event->code = KEY_NS_PUT_WORKING_TEXT;
@@ -6167,6 +6170,12 @@ syms_of_nsterm ()
               "String for visualizing working composition sequence.");
   ns_working_text =Qnil;
 
+  DEFVAR_LISP ("ns-range-of-active-clause", &ns_range_of_active_clause,
+              "Range of an active clause in composition sequence. \
+The value is a cons which holds start point of active clause in working \
+text as car, and end point as cdr.");
+  ns_range_of_active_clause =Qnil;
+
   DEFVAR_LISP ("ns-input-font", &ns_input_font,
               "The font specified in the last NS event.");
   ns_input_font =Qnil;

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

end of thread, other threads:[~2017-12-27  0:14 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-26 12:20 bug#7282: 23.2; [PATCH] Improve text composition by Input Methods on MacOSX Keitaro Miyazaki
2010-10-27  5:46 ` YAMAMOTO Mitsuharu
2010-10-27  6:17   ` YAMAMOTO Mitsuharu
2010-10-27 14:56     ` Keitaro Miyazaki
2010-10-28  0:55       ` YAMAMOTO Mitsuharu
2010-10-28  6:15         ` Keitaro Miyazaki
2010-10-28  6:35           ` YAMAMOTO Mitsuharu
2010-10-28 15:31             ` Keitaro Miyazaki
2016-07-10 15:15               ` Alan Third
2017-12-27  0:14                 ` Alan Third

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