string(0, selectionEnd)).width;

        renderSelection(startX, endX);

        // Re-render the section of text that's selected.
        canvasCtx.save();
        canvasCtx.fillStyle = SELECTION_TEXT_COLOR;
        canvasCtx.fillText(editContext.text.substring(selectionStart, selectionEnd), TEXT_ANCHOR_X + canvasCtx.measureText(editContext.text.substring(0, selectionStart)).width, TEXT_ANCHOR_Y);
        canvasCtx.restore();

        // Update the EditContext's selection bounds to match the position and s