private char prevChar()
    {
        if ( undo.size() > 0 )
            return undo.remove(0);
        else if ( index < 0 )
            return (char)-1;
        else
        {
            Pair p = pairs.get(index);
            char[] data = p.getChars();
            // preload previous pair if needed
            offset--;
            while ( index > 0 && offset < 0 )
            {
                p = pairs.get(--index);
                if ( p.versions.nextSetBit(v)==v && p.length()>0 )
                {
                    data = p.getChars();
                    offset = data.length-1;
                }
            }
            if ( offset == -1 )
                return (char)-1;
            else
                return data[offset];
        }
    }