Beispiel #1
0
    protected void onDel()
    {
        LineInfo li = m_buffer[m_curLine];

        if (li.LENGTH > 0)
        {
            if (m_curIndex < li.LENGTH)
            {
                li.Remove(m_curIndex);
            }
            else
            {
                li.Remove(m_curIndex - 1);
                m_curIndex--;
            }

            return;
        }

        if (m_buffer.Count > 1)
        {
            m_buffer.Remove(li);

            if (m_curLine >= m_buffer.Count)
            {
                // 光标移至删除行的上一行
                m_curLine--;
                m_curIndex = m_buffer[m_curLine].GetLastLineIndex(m_curIndex % Defines.TEXT_AREA_WIDTH);
            }
            else
            {
                // 光标不动(自动指向删除行的下一行)
                m_curIndex = m_buffer[m_curLine].GetFirstLineIndex(m_curIndex % Defines.TEXT_AREA_WIDTH);
            }
        }
    }