示例#1
0
        private void FixCursorPosition(bool back)
        {
            if (UHelper.IsChinesePart(Coder.CodeManager.GetCodeData(mCursor.Row), mCursor.Col))
            {
                if (back)
                {
                    mCursor.Col--;
                }
                else
                {
                    mCursor.Col++;
                }
            }

            if (mCursor.Col < mRenderStartCol)
            {
                mRenderStartCol = mCursor.Col;
            }
            if (mCursor.Col >= mRenderStartCol + mRenderSize.Col)
            {
                mRenderStartCol = mCursor.Col - mRenderSize.Col + 1;
            }
            if (mCursor.Row < mRenderStartRow)
            {
                mRenderStartRow = mCursor.Row;
            }
            if (mCursor.Row > mRenderStartRow + mRenderSize.Row)
            {
                mRenderStartRow = mCursor.Row - mRenderSize.Row + 1;
            }
        }
示例#2
0
        /// <summary>
        /// 删除指定位置的一个字符
        /// </summary>
        /// <param name="pos">开始位置</param>
        public void RemoveCharacter(URank pos)
        {
            if (pos.Row < 0 || pos.Row >= mCodeData.Count)
            {
                throw new Exception("RemoveCharacter : Row Invalid {" + pos.Row.ToString() + "}");
            }

            if (pos.Col < 0 || pos.Col >= mCodeData[pos.Row].Count)
            {
                throw new Exception("RemoveCharacter : Col Invalid {" + pos.Col.ToString() + "}");
            }

            if (UHelper.IsChinesePart(mCodeData[pos.Row].ToArray(), pos.Col))
            {
                mCodeData[pos.Row].RemoveRange(pos.Col - 1, 2);
                mCoder.SetCursorPos(new URank(pos.Row, pos.Col - 2));
            }
            else
            {
                mCodeData[pos.Row].RemoveAt(pos.Col);
                mCoder.SetCursorPos(new URank(pos.Row, pos.Col));
            }

            mCodeLines[pos.Row] = mParser.ParseLine(pos.Row);
        }