diff options
author | Jed Barber <jjbarber@y7mail.com> | 2016-11-13 18:59:54 +1100 |
---|---|---|
committer | Jed Barber <jjbarber@y7mail.com> | 2016-11-13 18:59:54 +1100 |
commit | 4aea3718c6de90471d0f63d930a874c87edb3fcd (patch) | |
tree | 3631c199026cffd70df6d2f38e6fb1abfb9a3d44 /src/adapad.adb | |
parent | 9a7351c664d7f05232cb3f934658c79fffc752fd (diff) |
Fixed bug in word count
Diffstat (limited to 'src/adapad.adb')
-rw-r--r-- | src/adapad.adb | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/adapad.adb b/src/adapad.adb index 8574d34..a045cfe 100644 --- a/src/adapad.adb +++ b/src/adapad.adb @@ -220,14 +220,16 @@ package body Adapad is (Item : in out FLTK.Widgets.Widget'Class) is Restore_Position : Natural := Editor.Get_Insert_Position; - Current_Position, New_Position, Result : Natural := 0; + Current_Position, Result : Natural := 0; begin Editor.Set_Insert_Position (0); + if Character'Pos (Buffer.Character_At (0)) > Character'Pos (' ') then + Result := 1; + end if; loop Editor.Next_Word; - New_Position := Editor.Get_Insert_Position; - exit when New_Position = Buffer.Length; - Current_Position := New_Position; + Current_Position := Editor.Get_Insert_Position; + exit when Current_Position = Buffer.Length; Result := Result + 1; end loop; Editor.Set_Insert_Position (Restore_Position); |