}
}
private boolean messageBoxClick(boolean singleClick, Position p) {
Document document = modes.getDocument();
Message message = modes.getMessage();
KetPanel ketPanel = document.getKetPanel();
// box list: (BoxWord) start, (BoxWord) "|", (BoxWord) end
BoxList messageBox = ketPanel.getMessageBoxList();
if (messageBox==null) return false;
Box clickedOn = messageBox.findDeepestBox(p);
boolean messageBoxClick = clickedOn!=null;
if (!messageBoxClick) return false;
Vector<Box> children = messageBox.getChildren();
if (children.size()!=3) return false;
BoxWord startBoxWord = (BoxWord) children.get(0);
BoxWord endBoxWord = (BoxWord) children.get(2);
int index = -1;
if (startBoxWord==clickedOn) {
index = startBoxWord.getIndex(p)-1;
} else if (endBoxWord==clickedOn) {
// Including cursor index.
int indent = message.getStart().length();
index = indent + endBoxWord.getIndex(p) + 1;
} else {
return false;
}
if (index==-1) return false;
message.setIndex(index);
return true;
}