From 1f9e7a15d9414b1a96691111069523a70e107f16 Mon Sep 17 00:00:00 2001 From: Jed Barber Date: Tue, 4 Oct 2016 18:52:32 +1100 Subject: Basic find functionality working --- src/adapad.adb | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'src/adapad.adb') diff --git a/src/adapad.adb b/src/adapad.adb index 7440ce9..bea6b91 100644 --- a/src/adapad.adb +++ b/src/adapad.adb @@ -282,10 +282,19 @@ function Adapad return Integer is (This : in Do_Find_Callback; Item : in String; Match_Case : in Boolean) is + + Current_Position : Natural; + Found_At : Natural; + begin - Ada.Text_IO.Put_Line ("Finding " & Item); - if Match_Case then - Ada.Text_IO.Put_Line ("Matching case"); + Find.Hide; + Current_Position := Editor.Get_Insert_Position; + if Buffer.Search_Forward (Current_Position, Item, Found_At, Match_Case) then + Buffer.Set_Selection (Found_At, Found_At + Item'Length); + Editor.Set_Insert_Position (Found_At + Item'Length); + Editor.Show_Insert_Position; + else + Alert ("No occurrences of '" & Item & "' found!"); end if; end Call; -- cgit