summaryrefslogtreecommitdiff
path: root/src/adapad.adb
diff options
context:
space:
mode:
Diffstat (limited to 'src/adapad.adb')
-rw-r--r--src/adapad.adb29
1 files changed, 17 insertions, 12 deletions
diff --git a/src/adapad.adb b/src/adapad.adb
index fb34196..82aa1ad 100644
--- a/src/adapad.adb
+++ b/src/adapad.adb
@@ -8,6 +8,7 @@ with Windows.Editor;
with Windows.About;
with Windows.Find;
with Windows.Replace;
+with Windows.Jump;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
@@ -34,6 +35,7 @@ package body Adapad is
About : Windows.About.About_Window := Windows.About.Create;
Find : Windows.Find.Find_Window := Windows.Find.Create;
Replace : Windows.Replace.Replace_Window := Windows.Replace.Create;
+ Jump : Windows.Jump.Jump_Window := Windows.Jump.Create;
Changed : Boolean := False;
Filename : Unbounded_String := To_Unbounded_String (0);
@@ -216,19 +218,10 @@ package body Adapad is
procedure Jump_CB
- (Item : in out FLTK.Widgets.Widget'Class)
- is
- User_Input : String := FLTK.Dialogs.Text_Input ("Line number: ");
- Line_Number : Integer;
+ (Item : in out FLTK.Widgets.Widget'Class) is
begin
- Line_Number := Integer'Value (User_Input);
- if Line_Number > 0 then
- Editor.Set_Insert_Position (Buffer.Skip_Lines (0, Line_Number - 1));
- Editor.Show_Insert_Position;
- end if;
- exception
- when Constraint_Error =>
- null; -- user has entered nonsense input, do nothing
+ Centre (Jump);
+ Jump.Show;
end Jump_CB;
@@ -427,6 +420,17 @@ package body Adapad is
+ procedure Do_Jump_CB
+ (Line_Number : in Positive) is
+ begin
+ Jump.Hide;
+ Editor.Set_Insert_Position (Buffer.Skip_Lines (0, Line_Number - 1));
+ Editor.Show_Insert_Position;
+ end Do_Jump_CB;
+
+
+
+
-- helper functions
procedure Set_Title is
@@ -592,6 +596,7 @@ begin
Find.Set_Find_Callback (Do_Find_CB'Access);
Replace.Set_Replace_Callback (Do_Replace_CB'Access);
+ Jump.Set_Jump_Callback (Do_Jump_CB'Access);
Buffer.Add_Modify_Callback (Mod_CB'Access);
Editor.Set_Callback (Quit_CB'Access);