Skip to content
This repository has been archived by the owner on Oct 16, 2020. It is now read-only.

Commit

Permalink
fixed compile errors
Browse files Browse the repository at this point in the history
do not trim end of line while correcting the indentation
  • Loading branch information
siegfriedpammer committed Nov 25, 2010
1 parent 5e68dff commit dabf54f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,12 @@ void FormatLineInternal(ITextEditor editor, int lineNr, int cursorOffset, char c
InsertDocumentationComments(editor, lineNr, cursorOffset);
}

if (ch == '\n' && lineAboveText != null)
{
if (ch == '\n' && lineAboveText != null) {
if (IsInsideDocumentationComment(editor, lineAbove, lineAbove.EndOffset)) {
editor.Document.Insert(cursorOffset, "''' ");
return;
}

string textToReplace = lineAboveText.TrimLine();

if (doCasing)
Expand All @@ -153,12 +157,10 @@ void FormatLineInternal(ITextEditor editor, int lineNr, int cursorOffset, char c

if (IsInString(lineAboveText)) {
if (IsFinishedString(curLineText)) {
editor.Document.Insert(lineAbove.Offset + lineAbove.Length,
"\" & _");
editor.Document.Insert(lineAbove.EndOffset, "\" & _");
editor.Document.Insert(currentLine.Offset, "\"");
} else {
editor.Document.Insert(lineAbove.Offset + lineAbove.Length,
"\"");
editor.Document.Insert(lineAbove.EndOffset, "\"");
}
} else {
string indent = DocumentUtilitites.GetWhitespaceAfter(editor.Document, lineAbove.Offset);
Expand All @@ -170,11 +172,8 @@ void FormatLineInternal(ITextEditor editor, int lineNr, int cursorOffset, char c
}

IndentLines(editor, lineNr - 1, lineNr);
}
else if(ch == '>')
{
if (IsInsideDocumentationComment(editor, currentLine, cursorOffset))
{
} else if(ch == '>') {
if (IsInsideDocumentationComment(editor, currentLine, cursorOffset)) {
int column = editor.Caret.Offset - currentLine.Offset;
int index = Math.Min(column - 1, curLineText.Length - 1);

Expand Down Expand Up @@ -507,13 +506,10 @@ static bool IsInsideDocumentationComment(ITextEditor editor, IDocumentLine curLi
{
for (int i = curLine.Offset; i < cursorOffset; ++i) {
char ch = editor.Document.GetCharAt(i);
if (ch == '"') {
if (ch == '"')
return false;
}
if (ch == '\'' && i + 2 < cursorOffset && editor.Document.GetCharAt(i + 1) == '\'' && editor.Document.GetCharAt(i + 2) == '\'')
{
return true;
}
}
return false;
}
Expand Down Expand Up @@ -736,7 +732,7 @@ static void ApplyToRange(ITextEditor editor, Stack<string> indentation, int begi

for (int i = begin; i <= end; i++) {
IDocumentLine curLine = editor.Document.GetLine(i);
string lineText = curLine.Text.Trim(' ', '\t', '\r', '\n');
string lineText = curLine.Text.TrimStart(' ', '\t', '\r', '\n');
string noComments = lineText.TrimComments().TrimEnd(' ', '\t', '\r', '\n');

if (i < selBegin || i > selEnd) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)

using System;
using System.Text.RegularExpressions;

namespace ICSharpCode.VBNetBinding
{
Expand Down

0 comments on commit dabf54f

Please sign in to comment.