From 52b7a0dbc7bd4926fed4cbf668953a97cd5e8937 Mon Sep 17 00:00:00 2001
From: H.G.Muller <hgm@hgm-xboard.(none)>
Date: Wed, 15 Oct 2014 20:26:31 +0200
Subject: [PATCH] Reset move entry on Clear Board

The board markers would stay on when the board was cleared, and a
no-longer-present piece would stay selected, leading to deletion of the
first piece that you tried to select.
---
 backend.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/backend.c b/backend.c
index 1c684ad..fe70fd2 100644
--- a/backend.c
+++ b/backend.c
@@ -15078,6 +15078,8 @@ EditPositionMenuEvent (ChessSquare selection, int x, int y)
 
     switch (selection) {
       case ClearBoard:
+	fromX = fromY = killX = killY = -1; // [HGM] abort any move entry in progress
+	MarkTargetSquares(1);
 	CopyBoard(currentBoard, boards[0]);
 	CopyBoard(menuBoard, initialPosition);
 	if (gameMode == IcsExamining && ics_type == ICS_FICS) {
-- 
1.7.0.4