[MonoDevelop] [patch] ctrl-up/down in source editor

Ben Motmans Ben Motmans <ben.motmans@gmail.com>
Thu, 10 Feb 2005 02:25:22 +0100


------=_Part_2428_13228168.1107998722911
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

little patch that allows you to use control-up and control-down to
scroll through the source editor without moving the cursor

------=_Part_2428_13228168.1107998722911
Content-Type: text/x-patch; name="ctrlupdown.diff"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment; filename="ctrlupdown.diff"

Index: Core/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorView.cs
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- Core/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorView.cs=09=
(revision 2242)
+++ Core/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorView.cs=09=
(working copy)
@@ -246,6 +246,26 @@
 =09=09=09
 =09=09=09return true;
 =09=09}
+
+=09=09void ScrollUp () {
+=09=09=09ParentEditor.Vadjustment.Value -=3D (ParentEditor.Vadjustment.Ste=
pIncrement / 5);
+=09=09=09if (ParentEditor.Vadjustment.Value < 0.0d)
+=09=09=09=09ParentEditor.Vadjustment.Value =3D 0.0d;
+
+=09=09=09ParentEditor.Vadjustment.Change();
+=09=09=09ParentEditor.Vadjustment.ChangeValue();
+=09=09}
+
+=09=09void ScrollDown () {
+=09=09=09double maxvalue =3D ParentEditor.Vadjustment.Upper - ParentEditor=
.Vadjustment.PageSize;
+
+=09=09=09ParentEditor.Vadjustment.Value +=3D (ParentEditor.Vadjustment.Ste=
pIncrement / 5);
+=09=09=09if (ParentEditor.Vadjustment.Value > maxvalue)
+=09=09=09=09ParentEditor.Vadjustment.Value =3D maxvalue;
+
+=09=09=09ParentEditor.Vadjustment.Change();
+=09=09=09ParentEditor.Vadjustment.ChangeValue();
+=09=09}
 =09=09
 =09=09protected override bool OnKeyPressEvent (Gdk.EventKey evnt)
 =09=09{
@@ -306,6 +326,12 @@
 =09=09=09=09case Gdk.Key.l:
 =09=09=09=09=09DeleteLine ();
 =09=09=09=09=09return true;
+=09=09=09=09case Gdk.Key.Up:
+=09=09=09=09=09ScrollUp ();
+=09=09=09=09=09return true;
+=09=09=09=09case Gdk.Key.Down:
+=09=09=09=09=09ScrollDown ();
+=09=09=09=09=09return true;
 =09=09=09=09}
 =09=09=09=09break;
 =09=09=09}

------=_Part_2428_13228168.1107998722911--