public CharPos charat(Coord c) { if (c.y < -sb.val) { if (msgs.size() < 1) return (null); Message msg = msgs.get(0); if (!(msg.text() instanceof RichText)) return (null); RichText.TextPart fp = null; for (RichText.Part part = ((RichText) msg.text()).parts; part != null; part = part.next) { if (part instanceof RichText.TextPart) { fp = (RichText.TextPart) part; break; } } if (fp == null) return (null); return (new CharPos(msg, fp, TextHitInfo.leading(0))); } Coord hc = new Coord(); Message msg = messageat(c, hc); if ((msg == null) || !(msg.text() instanceof RichText)) return (null); RichText rt = (RichText) msg.text(); RichText.Part p = rt.partat(hc); if (p == null) { RichText.TextPart lp = null; for (RichText.Part part = ((RichText) msg.text()).parts; part != null; part = part.next) { if (part instanceof RichText.TextPart) lp = (RichText.TextPart) part; } if (lp == null) return (null); return (new CharPos(msg, lp, TextHitInfo.trailing(lp.end - lp.start - 1))); } if (!(p instanceof RichText.TextPart)) return (null); RichText.TextPart tp = (RichText.TextPart) p; return (new CharPos(msg, tp, tp.charat(hc))); }