# http://code.google.com/p/mozc/issues/detail?id=50
=== modified file 'unix/emacs/mozc.el'
--- a/unix/emacs/mozc.el 2010-10-10 05:14:56 +0000
+++ b/unix/emacs/mozc.el 2010-10-10 05:46:39 +0000
@@ -351,16 +351,24 @@
"Make a preedit text and set its text properties.
PREEDIT must be the preedit field in a response protobuf.
Non-nil SEPARATOR is inserted between each piece of segments."
- (mapconcat
- (lambda (segment)
- (apply 'propertize (mozc-protobuf-get segment 'value)
- (case (mozc-protobuf-get segment 'annotation)
- (highlight
- '(face mozc-preedit-selected-face))
- (t
- '(face mozc-preedit-face)))))
- (mozc-protobuf-get preedit 'segment)
- separator))
+ (let* ((segments (mozc-protobuf-get preedit 'segment))
+ (retval (mapconcat
+ (lambda (segment)
+ (apply 'propertize (mozc-protobuf-get segment 'value)
+ (case (mozc-protobuf-get segment 'annotation)
+ (highlight
+ '(face mozc-preedit-selected-face))
+ (t
+ '(face mozc-preedit-face)))))
+ segments
+ separator))
+ (cursor (mozc-protobuf-get preedit 'cursor)))
+ (if (and (= 1 (length segments))
+ (< cursor (length retval)))
+ (put-text-property cursor (1+ cursor)
+ 'face 'mozc-preedit-selected-face
+ retval))
+ retval))
(defvar mozc-preedit-style nil
"Visual style of preedit.