예제 #1
0
        public static int GetLineLength(this StringBuilder sb, int line)
        {
            int lineIndex      = sb.FindLineIndex(line);
            int afterLineIndex = sb.FindLineIndex(line + 1);
            int length         = afterLineIndex - lineIndex;

            return(length);
        }
예제 #2
0
        public static StringBuilder MoveCursorToLineStart(this StringBuilder sb)
        {
            int cursorLine = sb.FindIndexLine(sb.FindCursorIndex());
            int index      = sb.FindLineIndex(cursorLine);

            sb.RemoveCursor().AddCursorIndex(index);
            return(sb);
        }
예제 #3
0
 public static StringBuilder AddCursor(this StringBuilder sb, int line)
 {
     return(sb.Insert(sb.FindLineIndex(line + 1), cursor));
 }
예제 #4
0
 public static StringBuilder NewLine(this StringBuilder sb, int line, string value)
 {
     sb.RemoveCursor().Insert(sb.FindLineIndex(line), $"{Environment.NewLine}{value}").AddCursor(line + 1);
     return(sb);
 }
예제 #5
0
 public static StringBuilder NewLine(this StringBuilder sb, int line)
 {
     return(sb.RemoveCursor().Insert(sb.FindLineIndex(line), Environment.NewLine).AddCursor(line + 1));
 }