1:   // HomeEndKeys.cs  
2:   // Copyright (C) 2000 Mike Krueger
3:   // Copyright (C) 2000 Andrea Paatz
4:   //
5:   // This program is free software; you can redistribute it and/or modify
6:   // it under the terms of the GNU General Public License as published by
7:   // the Free Software Foundation; either version 2 of the License, or
8:   // (at your option) any later version.
9:   //
10:   // This program is distributed in the hope that it will be useful,
11:   // but WITHOUT ANY WARRANTY; without even the implied warranty of
12:   // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13:   // GNU General Public License for more details.
14:   //
15:   // You should have received a copy of the GNU General Public License
16:   // along with this program; if not, write to the Free Software
17:   // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18:  
19:   using System;
20:   using System.Drawing;
21:   using System.Windows.Forms;
22:  
23:   using SharpDevelop.DefaultEditor.Gui.Editor;
24:   using SharpDevelop.DefaultEditor.Text;
25:  
26:   namespace SharpDevelop.DefaultEditor.Actions {
27:       
28:       public class Home : AbstractEditAction
29:       {
30:           public override void Execute(IEditActionServices services)
31:           {
32:               LineSegment curLine services.Document.GetLineSegmentOfOffset(services.Document.Caret.Offset);
33:               
34:               if (TextUtilities.IsEmptyLine(services.DocumentcurLine)) {
35:                   if (services.Document.Caret.Offset != curLine.Offset) {
36:                       services.Document.Caret.Offset curLine.Offset;
37:                   else if (curLine.Length 0) {
38:                       services.Document.Caret.Offset curLine.Offset curLine.Length;
39:                   }
40:               else {
41:                   int firstCharOffset TextUtilities.GetFirstNonWSChar(services.DocumentcurLine.Offset);
42:                   
43:                   if (services.Document.Caret.Offset == firstCharOffset) {
44:                       if (services.Document.Caret.Offset != curLine.Offset) {
45:                           services.Document.Caret.Offset curLine.Offset;
46:                       }
47:                   else {
48:                       services.Document.Caret.Offset firstCharOffset;
49:                   }
50:               }
51:               
52:               services.Document.SetDesiredColumn();
53:           }
54:       }
55:       
56:       
57:       public class End : AbstractEditAction
58:       {
59:           public override void Execute(IEditActionServices services)
60:           {
61:               LineSegment curLine services.Document.GetLineSegmentOfOffset(services.Document.Caret.Offset);
62:               services.Document.Caret.Offset        curLine.Offset curLine.Length;
63:               services.Document.SetDesiredColumn();
64:           }        
65:       }
66:       
67:       
68:       public class MoveToStart : AbstractEditAction
69:       {
70:           public override void Execute(IEditActionServices services)
71:           {
72:               services.Document.Caret.Offset 0;
73:               services.Document.SetDesiredColumn();
74:           }
75:       }
76:       
77:       
78:       public class MoveToEnd : AbstractEditAction
79:       {
80:           public override void Execute(IEditActionServices services)
81:           {
82:               services.Document.Caret.Offset services.Document.TextLength;
83:               services.Document.SetDesiredColumn();
84:           }
85:       }
86:   }

This page was automatically generated by SharpDevelop.