From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Asher Gordon Newsgroups: gmane.emacs.bugs Subject: bug#40169: Fix drawing the horizontal line Date: Sun, 22 Mar 2020 23:26:16 -0400 Message-ID: <87r1xjlpk7.fsf_-_@posteo.net> References: <87d095ipza.fsf@posteo.net> <875zexfrs5.fsf_-_@posteo.net> <87pnd58f8t.fsf_-_@posteo.net> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="14366"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) To: 40169@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Mar 23 04:27:12 2020 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 1jGDk8-0003dC-0D for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 23 Mar 2020 04:27:12 +0100 Original-Received: from localhost ([::1]:56844 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jGDk7-00074X-2T for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 22 Mar 2020 23:27:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52263) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jGDjz-00074F-Rg for bug-gnu-emacs@gnu.org; Sun, 22 Mar 2020 23:27:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jGDjy-0000WR-GB for bug-gnu-emacs@gnu.org; Sun, 22 Mar 2020 23:27:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:45349) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jGDjx-0000WE-WF for bug-gnu-emacs@gnu.org; Sun, 22 Mar 2020 23:27:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jGDjx-0002UJ-ST for bug-gnu-emacs@gnu.org; Sun, 22 Mar 2020 23:27:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Asher Gordon Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 23 Mar 2020 03:27:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 40169 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 40169-submit@debbugs.gnu.org id=B40169.15849339969509 (code B ref 40169); Mon, 23 Mar 2020 03:27:01 +0000 Original-Received: (at 40169) by debbugs.gnu.org; 23 Mar 2020 03:26:36 +0000 Original-Received: from localhost ([127.0.0.1]:51322 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jGDjX-0002TJ-SB for submit@debbugs.gnu.org; Sun, 22 Mar 2020 23:26:36 -0400 Original-Received: from mout01.posteo.de ([185.67.36.65]:36436) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jGDjU-0002T4-SO for 40169@debbugs.gnu.org; Sun, 22 Mar 2020 23:26:34 -0400 Original-Received: from submission (posteo.de [89.146.220.130]) by mout01.posteo.de (Postfix) with ESMTPS id 57F2516005C for <40169@debbugs.gnu.org>; Mon, 23 Mar 2020 04:26:26 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1584933986; bh=oAwD/feG+W3qmh2O7wYuRPNtd3uHzGtHwnj/4BxhOB0=; h=From:To:Subject:Date:From; b=Mt5C7EU5upx6WOH7d0MXitQAk6+6/yk0J6dnLHGIzVfpHbrp65pwAs+MlEJJv1UnF 6GGIAEhIX9gbPLhbAFKoQofpgPYHwoCx1yD2PQLmZUtAgwmO3wNWwCOGbrqvtRgTxq l03VH6BA/S1HY7lwXN9fYGCpxh9168rjYbnEXpq7dFQM7Xa0hp97CRu3X30hYgyVz0 MdKKnvtd7x51UQM5H1g93fW0JskuPdXIXnGKNwcOGXItB0n8pLBnQk0VGSlDwx8Uok pmyIQI/mvm/JR4WOpXIt74V7tLBijnYGBh+D4Cc22nzB5ivniKnwRjvjN35W2PfPn1 QQUpFHD8/JL9g== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 48m0Ch0w6rz6tm7 for <40169@debbugs.gnu.org>; Mon, 23 Mar 2020 04:26:23 +0100 (CET) In-Reply-To: <87pnd58f8t.fsf_-_@posteo.net> (Asher Gordon's message of "Sat, 21 Mar 2020 19:22:58 -0400") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 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" Xref: news.gmane.io gmane.emacs.bugs:177641 Archived-At: --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain Whoops! I accidentally broke drawing the horizontal line when someone wins horizontally. Here is the patch below: --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=horizontal-line.patch Content-Description: Fix drawing the horizontal line --- gomoku.el~ 2020-03-21 19:13:36.284656730 -0400 +++ gomoku.el 2020-03-22 23:11:48.313804581 -0400 @@ -1114,7 +1114,7 @@ (setq square1 (+ square1 depl)) (cond ((= dy 0) ; Horizontal - (gomoku-move-right) + (forward-char 1) (insert-char ?- (1- gomoku-square-width) t) (delete-region (point) (progn (skip-chars-forward " \t") --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable And as before, I've also attached the fixed patch so you only have to apply one patch. Asher =2D-=20 One picture is worth 128K words. -------- I prefer to send and receive mail encrypted. Please send me your public key, and if you do not have my public key, please let me know. Thanks. GPG fingerprint: 38F3 975C D173 4037 B397 8095 D4C9 C4FC 5460 8E68 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=gomoku.patch Content-Transfer-Encoding: quoted-printable Content-Description: Fixed patch diff -u gomoku.el gomoku.el =2D-- gomoku.el 2020-03-21 19:13:36.284656730 -0400 +++ gomoku.el 2020-03-22 23:11:48.313804581 -0400 @@ -110,8 +110,8 @@ (define-key map "u" 'gomoku-move-ne) ; u (define-key map "b" 'gomoku-move-sw) ; b (define-key map "n" 'gomoku-move-se) ; n =2D (define-key map "h" 'backward-char) ; h =2D (define-key map "l" 'forward-char) ; l + (define-key map "h" 'gomoku-move-left) ; h + (define-key map "l" 'gomoku-move-right) ; l (define-key map "j" 'gomoku-move-down) ; j (define-key map "k" 'gomoku-move-up) ; k =20 @@ -119,11 +119,13 @@ (define-key map [kp-9] 'gomoku-move-ne) (define-key map [kp-1] 'gomoku-move-sw) (define-key map [kp-3] 'gomoku-move-se) =2D (define-key map [kp-4] 'backward-char) =2D (define-key map [kp-6] 'forward-char) + (define-key map [kp-4] 'gomoku-move-left) + (define-key map [kp-6] 'gomoku-move-right) (define-key map [kp-2] 'gomoku-move-down) (define-key map [kp-8] 'gomoku-move-up) =20 + (define-key map "\C-b" 'gomoku-move-left) ; C-b + (define-key map "\C-f" 'gomoku-move-right) ; C-f (define-key map "\C-n" 'gomoku-move-down) ; C-n (define-key map "\C-p" 'gomoku-move-up) ; C-p =20 @@ -146,6 +148,10 @@ (define-key map [mouse-2] 'gomoku-mouse-play) (define-key map [drag-mouse-2] 'gomoku-mouse-play) =20 + (define-key map [remap backward-char] 'gomoku-move-left) + (define-key map [remap left-char] 'gomoku-move-left) + (define-key map [remap forward-char] 'gomoku-move-right) + (define-key map [remap right-char] 'gomoku-move-right) (define-key map [remap previous-line] 'gomoku-move-up) (define-key map [remap next-line] 'gomoku-move-down) (define-key map [remap move-beginning-of-line] 'gomoku-beginning-of-li= ne) @@ -954,6 +960,11 @@ ;; 2 instead of 1 because WINDOW-HEIGHT includes the mode line ! gomoku-square-height))) =20 +(defun gomoku-point-x () + "Return the board column where point is." + (1+ (/ (- (current-column) gomoku-x-offset) + gomoku-square-width))) + (defun gomoku-point-y () "Return the board row where point is." (1+ (/ (- (count-lines (point-min) (point)) @@ -1143,13 +1154,28 @@ (skip-chars-forward gomoku--intangible-chars) (when (eobp) (skip-chars-backward gomoku--intangible-chars) =2D (forward-char -1))) + (gomoku-move-left))) (skip-chars-backward gomoku--intangible-chars) (if (bobp) (skip-chars-forward gomoku--intangible-chars) =2D (forward-char -1)))) + (gomoku-move-left)))) (setq gomoku--last-pos (point))) =20 +;; forward-char and backward-char don't always move the right number +;; of characters. Also, these functions check if you're on the edge of +;; the screen. +(defun gomoku-move-right () + "Move point right one column on the Gomoku board." + (interactive) + (when (< (gomoku-point-x) gomoku-board-width) + (forward-char gomoku-square-width))) + +(defun gomoku-move-left () + "Move point left one column on the Gomoku board." + (interactive) + (when (> (gomoku-point-x) 1) + (backward-char gomoku-square-width))) + ;; previous-line and next-line don't work right with intangible newlines (defun gomoku-move-down () "Move point down one row on the Gomoku board." @@ -1171,25 +1197,25 @@ "Move point North East on the Gomoku board." (interactive) (gomoku-move-up) =2D (forward-char)) + (gomoku-move-right)) =20 (defun gomoku-move-se () "Move point South East on the Gomoku board." (interactive) (gomoku-move-down) =2D (forward-char)) + (gomoku-move-right)) =20 (defun gomoku-move-nw () "Move point North West on the Gomoku board." (interactive) (gomoku-move-up) =2D (backward-char)) + (gomoku-move-left)) =20 (defun gomoku-move-sw () "Move point South West on the Gomoku board." (interactive) (gomoku-move-down) =2D (backward-char)) + (gomoku-move-left)) =20 (defun gomoku-beginning-of-line () "Move point to first square on the Gomoku board row." --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEARYIAB0WIQQ485dc0XNAN7OXgJXUycT8VGCOaAUCXngsWAAKCRDUycT8VGCO aILIAQCmI3GUbHsdbA8TfNV7rmdhMstEXgrhHRsriSXmV4fUoQD+Io7E1G+/2/80 nDjRxEmZIthJOuu42OOmajOODW9y7Q8= =/eZW -----END PGP SIGNATURE----- --==-=-=--