From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Newsgroups: gmane.emacs.bugs Subject: bug#66970: 29.1; Overwrite-mode is not working with Korean characters Date: Thu, 9 Nov 2023 16:37:17 +0000 Message-ID: References: <53b382ce-b331-4473-807c-e453df9ea250@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27008"; mail-complaints-to="usenet@ciao.gmane.io" To: Eli Zaretskii , 66970@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Nov 09 17:38:43 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1r183E-0006nd-4m for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 09 Nov 2023 17:38:40 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r182z-0005zk-GI; Thu, 09 Nov 2023 11:38:25 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r182x-0005zM-1o for bug-gnu-emacs@gnu.org; Thu, 09 Nov 2023 11:38:23 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r182w-0008H7-Q1 for bug-gnu-emacs@gnu.org; Thu, 09 Nov 2023 11:38:22 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1r183Z-0004yW-UV for bug-gnu-emacs@gnu.org; Thu, 09 Nov 2023 11:39:01 -0500 X-Loop: help-debbugs@gnu.org In-Reply-To: <53b382ce-b331-4473-807c-e453df9ea250@gmail.com> Resent-From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 09 Nov 2023 16:39:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66970 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: moreinfo Original-Received: via spool by 66970-submit@debbugs.gnu.org id=B66970.169954789719073 (code B ref 66970); Thu, 09 Nov 2023 16:39:01 +0000 Original-Received: (at 66970) by debbugs.gnu.org; 9 Nov 2023 16:38:17 +0000 Original-Received: from localhost ([127.0.0.1]:48624 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r182r-0004xZ-9v for submit@debbugs.gnu.org; Thu, 09 Nov 2023 11:38:17 -0500 Original-Received: from mail-lf1-x134.google.com ([2a00:1450:4864:20::134]:51630) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r182o-0004xK-Ft for 66970@debbugs.gnu.org; Thu, 09 Nov 2023 11:38:15 -0500 Original-Received: by mail-lf1-x134.google.com with SMTP id 2adb3069b0e04-507bd644a96so1480606e87.3 for <66970@debbugs.gnu.org>; Thu, 09 Nov 2023 08:37:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1699547849; x=1700152649; darn=debbugs.gnu.org; h=content-transfer-encoding:to:subject:message-id:date:from :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=J3KlrIFb34U1ulKvxClGhpc+tCy6QFnrEQSyH9IxVjI=; b=iu6PqCamF0ex7RhY3MJTW6kUOhPYfPZPdXpVwtljsK23mkOIJkrC/aXI6lo08WfK87 firRTLVGjdzl01AEQd/YXv7mJD+L3BZHYLSXXTGATDoZbd+KMchd4jpuw7tUWZZ0Juj7 yqG1OXNyC+kZRv+t0ZwxC6Evt1c7SWYEmnvN57TPKTrovH+7toFL0XN7YUVeweVwbDZS hKIi4ULuOAYuGJRVw/ub/5VYo9gN78yYW2lWLbL+q2b8bibSTvhopurjKlqf9MB3pJwu Gbi80eatpchgah25lj+mKFwXyFzx3gAH5/h7ERR00UUsDUbMD7kyMv6z3SyXvH4PTHGT 40mQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699547849; x=1700152649; h=content-transfer-encoding:to:subject:message-id:date:from :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=J3KlrIFb34U1ulKvxClGhpc+tCy6QFnrEQSyH9IxVjI=; b=VI+cZeH2tSNecOW9hYkpae0B7+68MzhII9zRMucgVCRTXvcmpuNCk+g9tCGfYsaFSy sDTKQqPCV/oUBENCOqUl0+Odj//z8xX2Qz8/67UhVMH4ime/zAghOyCk+67DbO74Y7ad ZGUH4WOPJMkmhs7X9hTCl5xuJO/0vFOxTf1g1MZQXuR9MDlBlsrXrwSWPZtI1iJmLRx8 h+yelbTFWITAk/VJPtO9oPtpIWqC8nZbKxbiJyZGBwWlWlV4xXmONf/yzDfrKosF2+hm 06bhh6J2VrAjIIZDe3sF1Rw/qjoA5Exwgv6NEA6CLgEO6OTXT2gr/UegNSdWLPzRWsKL sLSg== X-Gm-Message-State: AOJu0YxPf238Gkx6CFDKtX4+Fx6ZCJOZzL9SNh0YtfcQq2KLZTJbxV3d FBUvWkkFy3UAX2vojyyta1teodnwNMJG6KB7/7tDoQF8gMEkcQ== X-Google-Smtp-Source: AGHT+IEjgC7S29nZsIU5ajjJ5Kd63E26kUdrLqo01C1ibwS9orM6PFNKRsypcgl2Z+XN8rQPCxTRwmuzlWQt9plvJwQ= X-Received: by 2002:a05:6512:b02:b0:507:b7b7:e740 with SMTP id w2-20020a0565120b0200b00507b7b7e740mr2134565lfu.43.1699547848985; Thu, 09 Nov 2023 08:37:28 -0800 (PST) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:274056 Archived-At: 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. 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 i= s + ;; non-nil, of course) + (=3D (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. --=20 Jo=C3=A3o T=C3=A1vora