Esempio n. 1
0
        /// <summary>
        /// Moves the cusor left by the specified amount of columns, wrapping the cursor if needed.
        /// </summary>
        /// <param name="amount">The amount of columns to move the cursor</param>
        /// <returns>This cursor object.</returns>
        public Cursor LeftWrap(int amount)
        {
            var console = ((SurfaceEditor)_console.Target);

            int index = TextSurface.GetIndexFromPoint(this._position, console.TextSurface.Width) - amount;

            if (index < 0)
            {
                index = 0;
            }

            this._position = TextSurface.GetPointFromIndex(index, console.TextSurface.Width);

            return(this);
        }
Esempio n. 2
0
        /// <summary>
        /// Moves the cusor right by the specified amount of columns, wrapping the cursor if needed.
        /// </summary>
        /// <param name="amount">The amount of columns to move the cursor</param>
        /// <returns>This cursor object.</returns>
        public Cursor RightWrap(int amount)
        {
            var console = ((SurfaceEditor)_console.Target);


            int index = TextSurface.GetIndexFromPoint(this._position, console.TextSurface.Width) + amount;

            if (index > console.TextSurface.Cells.Length)
            {
                index = console.TextSurface.Cells.Length - 1;
            }

            this._position = TextSurface.GetPointFromIndex(index, console.TextSurface.Width);

            return(this);
        }