~ubuntu-branches/ubuntu/oneiric/monodevelop/oneiric

« back to all changes in this revision

Viewing changes to src/core/Mono.Texteditor/Mono.TextEditor.Vi/ViActions.cs

  • Committer: Bazaar Package Importer
  • Author(s): Jo Shields
  • Date: 2011-06-27 17:03:13 UTC
  • mto: (1.8.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 54.
  • Revision ID: james.westby@ubuntu.com-20110627170313-6cvz3s19x6e9hqe9
ImportĀ upstreamĀ versionĀ 2.5.92+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
        {
38
38
                public static void MoveToNextEmptyLine (TextEditorData data)
39
39
                {
40
 
                        if (data.Caret.Line == data.Document.LineCount - 1) {
 
40
                        if (data.Caret.Line == data.Document.LineCount) {
41
41
                                data.Caret.Offset = data.Document.Length;
42
42
                                return;
43
43
                        }
44
44
                        
45
45
                        int line = data.Caret.Line + 1;
46
46
                        LineSegment currentLine = data.Document.GetLine (line);
47
 
                        while (line < data.Document.LineCount - 1) {
 
47
                        while (line <= data.Document.LineCount) {
48
48
                                line++;
49
49
                                LineSegment nextLine = data.Document.GetLine (line);
50
50
                                if (currentLine.EditableLength != 0 && nextLine.EditableLength == 0) {
59
59
                
60
60
                public static void MoveToPreviousEmptyLine (TextEditorData data)
61
61
                {
62
 
                        if (data.Caret.Line == 0) {
 
62
                        if (data.Caret.Line == DocumentLocation.MinLine) {
63
63
                                data.Caret.Offset = 0;
64
64
                                return;
65
65
                        }
66
66
                        
67
67
                        int line = data.Caret.Line - 1;
68
68
                        LineSegment currentLine = data.Document.GetLine (line);
69
 
                        while (line > 0) {
 
69
                        while (line > DocumentLocation.MinLine) {
70
70
                                line--;
71
71
                                LineSegment previousLine = data.Document.GetLine (line);
72
72
                                if (currentLine.EditableLength != 0 && previousLine.EditableLength == 0) {
88
88
                
89
89
                public static void NewLineAbove (TextEditorData data)
90
90
                {
91
 
                        if (data.Caret.Line == 0) {
 
91
                        if (data.Caret.Line == DocumentLocation.MinLine ) {
92
92
                                data.Caret.Offset = 0;
93
93
                                MiscActions.InsertNewLine (data);
94
94
                                data.Caret.Offset = 0;
115
115
                        if (endLine == startLine)
116
116
                                endLine++;
117
117
                        
118
 
                        if (endLine >= data.Document.LineCount)
 
118
                        if (endLine > data.Document.LineCount)
119
119
                                return;
120
120
                        
121
121
                        LineSegment seg = data.Document.GetLine (startLine);
159
159
                                        ch = Char.ToLower (ch);
160
160
                                int length = data.Replace (data.Caret.Offset, 1, new string (ch, 1));
161
161
                                LineSegment seg = data.Document.GetLine (data.Caret.Line);
162
 
                                if (data.Caret.Column < seg.EditableLength - 1)
 
162
                                if (data.Caret.Column < seg.EditableLength)
163
163
                                        data.Caret.Offset += length;
164
164
                        }
165
165
                }
175
175
                
176
176
                public static void Left (TextEditorData data)
177
177
                {
178
 
                        if (0 < data.Caret.Column) {
 
178
                        if (DocumentLocation.MinColumn < data.Caret.Column) {
179
179
                                CaretMoveActions.Left (data);
180
180
                        }
181
181
                }
228
228
                internal static void RetreatFromLineEnd (TextEditorData data)
229
229
                {
230
230
                        if (data.Caret.Mode == CaretMode.Block && !data.IsSomethingSelected && !data.Caret.PreserveSelection) {
231
 
                                while (0 < data.Caret.Column && (data.Caret.Offset >= data.Document.Length
 
231
                                while (DocumentLocation.MinColumn < data.Caret.Column && (data.Caret.Offset >= data.Document.Length
232
232
                                                                 || IsEol (data.Document.GetCharAt (data.Caret.Offset)))) {
233
233
                                        Left (data);
234
234
                                }