diff options
Diffstat (limited to 'src/adapad.adb')
-rw-r--r-- | src/adapad.adb | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/src/adapad.adb b/src/adapad.adb index 71b0a0b..8574d34 100644 --- a/src/adapad.adb +++ b/src/adapad.adb @@ -11,9 +11,6 @@ with Windows.Replace; with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; -with Ada.Text_IO; - - package body Adapad is @@ -200,6 +197,25 @@ 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; + 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 + end Jump_CB; + + + + procedure Count_CB (Item : in out FLTK.Widgets.Widget'Class) is @@ -457,7 +473,8 @@ begin Bar.Add (Text => "&Search", Flags => Flag_Submenu); Bar.Add ("Search/&Find...", Find_CB'Access, Mod_Ctrl + 'f'); Bar.Add ("Search/&Replace...", Replace_CB'Access, Mod_Ctrl + 'h', Flag_Divider); - Bar.Add ("Search/&Word Count", Count_CB'Access); + Bar.Add ("Search/Jump To...", Jump_CB'Access, Mod_Ctrl + 'j'); + Bar.Add ("Search/Word Count", Count_CB'Access); Bar.Add (Text => "&Options", Flags => Flag_Submenu); Bar.Add ("Options/&Word Wrap", Wrap_CB'Access, No_Key, Flag_Toggle); |