Example #1
0
        /**************************************************************/
        /*                         Elide
        /**************************************************************/
        /// <summary>
        /// Elides nearest block.
        /// </summary>
        /// <param name="editView">Edit view</param>
        /// <param name="unElide">Unelide flag</param>
        public static void ElideNearestBlock(IOTAEditView editView, bool unElide)
        {
            if (editView != null)
            {
                IOTAElideActions aElideActions = editView as IOTAElideActions;

                if (aElideActions != null)
                {
                    if (unElide)
                    {
                        aElideActions.UnElideNearestBlock();
                    }
                    else
                    {
                        aElideActions.ElideNearestBlock();
                    }
                }
            }
        }
Example #2
0
		private static void SavePoint(IOTAEditView view) {
			lastPoint.X = view.LastEditColumn;
			lastPoint.Y = view.LastEditRow;
		}
Example #3
0
        /// <summary>
        /// Replaces inclusive and exclusive.
        /// </summary>
        /// <param name="sourceEditor">Source editor</param>
        /// <param name="editView">Edit view</param>
        /// <param name="isInclusive">Is inclusive flag</param>
        /// <param name="start">Start</param>
        /// <param name="after">After</param>
        /// <param name="text">Text</param>
        private static void ReplaceInclusiveExclusive(IOTASourceEditor sourceEditor,
                                                      IOTAEditView editView,
                                                      bool isInclusive,
                                                      OTACharPos start, OTACharPos
                                                      after, string text)
        {

            if (sourceEditor == null || editView == null)
            {
                return;
            }

            bool _FirstCharInLineDeleted;

            if (!isInclusive)
            {
                _FirstCharInLineDeleted = (after.CharIndex == 1);

                if (after.CharIndex > 0)
                {
                    after.CharIndex -= 1;
                }
            }
            else
            {
                _FirstCharInLineDeleted = false;
            }

            int _StartPos = editView.CharPosToPos(start);
            int _AfterPos = editView.CharPosToPos(after);

            IOTAFileWriter _Writer = sourceEditor.CreateWriter();

            _Writer.CopyTo(_StartPos);
            int _DeleteToPos = _AfterPos;

            if (after.CharIndex == 0 && ((after.Line - start.Line) == 1))
            {
                _DeleteToPos -= 2;

                if (_FirstCharInLineDeleted)
                {
                    _DeleteToPos = +3;
                }
            }
            else
            {
                if (_FirstCharInLineDeleted)
                {
                    _DeleteToPos++;
                }
                else if (after.CharIndex > 0)
                {
                    _DeleteToPos++;
                }
            }

            if (_DeleteToPos > _StartPos)
            {
                _Writer.DeleteTo(_DeleteToPos);
            }

            _Writer.Insert(text);
            _Writer.CopyTo(Int32.MaxValue);
            _Writer.Close();
        }