GNU bug report logs -
#66970
29.1; Overwrite-mode is not working with Korean characters
Previous Next
Reported by: SUKBEOM KIM <sukbeom.kim <at> gmail.com>
Date: Mon, 6 Nov 2023 16:19:01 UTC
Severity: normal
Tags: moreinfo
Found in version 29.1
Done: Eli Zaretskii <eliz <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
Message #31 received at 66970 <at> debbugs.gnu.org (full text, mbox):
> From: João Távora <joaotavora <at> gmail.com>
> Date: Thu, 9 Nov 2023 16:37:17 +0000
>
> Eli brought up this bug in emacs-devel and I thought
> I would give it a shot.
>
> I had never touched this code or anything like it, but I do
> use input methods a bit for portuguese. Let me know what
> you think.
Thanks.
Sukbeom, could you please try the patch and see if it gives good
results, both with and without Overwrite mode?
> diff --git a/lisp/leim/quail/hangul.el b/lisp/leim/quail/hangul.el
> index 46a2e5a6ba2..7e6c7310179 100644
> --- a/lisp/leim/quail/hangul.el
> +++ b/lisp/leim/quail/hangul.el
> @@ -146,21 +146,34 @@ hangul-insert-character
> (progn
> (delete-region (region-beginning) (region-end))
> (deactivate-mark)))
> - (quail-delete-region)
> - (let ((first (car queues)))
> - (insert
> - (hangul-character
> - (+ (aref first 0) (hangul-djamo 'cho (aref first 0) (aref first 1)))
> - (+ (aref first 2) (hangul-djamo 'jung (aref first 2) (aref first 3)))
> - (+ (aref first 4) (hangul-djamo 'jong (aref first 4) (aref first 5))))))
> - (move-overlay quail-overlay (overlay-start quail-overlay) (point))
> - (dolist (queue (cdr queues))
> - (insert
> - (hangul-character
> - (+ (aref queue 0) (hangul-djamo 'cho (aref queue 0) (aref queue 1)))
> - (+ (aref queue 2) (hangul-djamo 'jung (aref queue 2) (aref queue 3)))
> - (+ (aref queue 4) (hangul-djamo 'jong (aref queue 4) (aref queue 5)))))
> - (move-overlay quail-overlay (1+ (overlay-start quail-overlay)) (point))))
> + (let* ((chars-to-insert
> + (with-temp-buffer
> + (dolist (queue queues (mapcar #'identity (buffer-string)))
> + (insert
> + (hangul-character
> + (+ (aref queue 0) (hangul-djamo 'cho (aref queue 0)
> (aref queue 1)))
> + (+ (aref queue 2) (hangul-djamo 'jung (aref queue 2)
> (aref queue 3)))
> + (+ (aref queue 4) (hangul-djamo 'jong (aref queue 4)
> (aref queue 5))))))))
> + (may-have-to-overwrite-p
> + (or
> + ;; If the overlay isn't showing (i.e. it has 0 length) then
> + ;; we may want to insert char overwriting (iff overwrite-mode is
> + ;; non-nil, of course)
> + (= (overlay-start quail-overlay) (overlay-end quail-overlay))
> + ;; Likewise we want to do it if there is more then one
> + ;; character that were combined.
> + (cdr chars-to-insert))))
> + (quail-delete-region) ; this kills the overlay
> + (dolist (c chars-to-insert)
> + (let ((last-command-event c)
> + (overwrite-mode (and overwrite-mode
> + may-have-to-overwrite-p
> + overwrite-mode)))
> + (self-insert-command 1)
> + ;; TODO: maybe use cl-loop for an easier-to-read loop?
> + (setq may-have-to-overwrite-p nil)))
> + ; this revives it (TODO: do we really always revive?)
> + (move-overlay quail-overlay (1- (point)) (point))))
>
> (defun hangul-djamo (jamo char1 char2)
> "Return the double Jamo index calculated from the arguments.
>
>
>
> --
> João Távora
>
This bug report was last modified 1 year and 243 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.