public void MoveParagraphEnd()
        {
            int line  = CurrentParagraph.LineFromPosition(CursorPosition);
            int line2 = CurrentParagraph.LineFromPosition(CursorPosition + 1);

            if (line2 > line)                   // we are EOL
            {
                CursorPosition = CurrentParagraph.Length - 1;
            }
            else
            {
                CursorPosition = CurrentParagraph.EolIndex(line);
            }

            ResetCursorColoumns();
            CurrentColumnEOL = true;
        }
        public void MoveParagraphHome()
        {
            ParagraphPosition pt = CurrentParagraph.PositionAtIndex(CursorPosition);
            int line             = pt.LineIndex;
            int col = pt.Column;

            if (col <= 0)
            {
                CursorPosition = 0;
            }
            else
            {
                CursorPosition = CurrentParagraph.PositionAtLineIndex(0, line);
            }

            ResetCursorColoumns();
            CurrentColumnBOL = true;
        }
        public void DeleteCurrentChar()
        {
            if (CurrentParagraph.Length == 1)
            {
                // Delete current line
                if (CurrentParagraphIndex < Paragraphs.Count - 1)
                {
                    Paragraphs.RemoveAt(CurrentParagraphIndex);
                }
            }
            else if (CursorPosition == CurrentParagraph.Length - 1)
            {
                if (CurrentParagraphIndex < Paragraphs.Count - 1)
                {
                    // merge with next line
                    Paragraph cp = CurrentParagraph;
                    Paragraph np = Paragraphs [CurrentParagraphIndex + 1];
                    cp.Glyphs.RemoveLast();
                    foreach (GlyphChar g in np.Glyphs)
                    {
                        cp.Glyphs.AddLast(g);
                    }
                    cp.NeedsWordWrap = true;
                    cp.WordWrap(BreakWidth);
                    Paragraphs.Remove(np);
                }
            }
            else
            {
                // remove current character from current position
                CurrentParagraph.RemoveChar(CursorPosition);
            }

            //Paragraphs.OnUpdateAsync (CurrentParagraphIndex, BreakWidth);
            Paragraphs.OnUpdate(CurrentParagraphIndex, BreakWidth, false, 250);
            CurrentParagraphIndex = CurrentParagraphIndex.Clamp(0, Paragraphs.Count - 1);
        }
 public bool ToNextParagraph()
 {
     if (IsEnd)
     {
         return(false);
     }
     else
     {
         currentParagraphIndex++;
         if (CurrentParagraph.IsSufficientPlotTriggerConditions())
         {
             if (IsEnd)
             {
                 ExecuteEvents();
             }
             return(true);
         }
         else
         {
             currentParagraphIndex--;
             return(false);
         }
     }
 }
 public void ResetCursorColoumns()
 {
     CurrentColumnBOL = false;
     CurrentColumnEOL = false;
     CurrentColumn    = CurrentParagraph.FastPositionAtIndex(CursorPosition);
 }