Skip to content

Commit

Permalink
Fixed a bug in the calculation of page up/down for the manga list.
Browse files Browse the repository at this point in the history
  • Loading branch information
Enoumy committed Oct 18, 2024
1 parent 3292684 commit 0a419de
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 31 deletions.
4 changes: 2 additions & 2 deletions app/capymanga/src/manga_table.ml
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,11 @@ module Action = struct
| Bottom -> { last_top_press = None; focus = bottom_most }
| Down_half_page ->
{ last_top_press = None
; focus = Int.min bottom_most (focus + (dimensions.height / 2))
; focus = Int.min bottom_most (focus + (dimensions.height / 6))
}
| Up_half_page ->
{ last_top_press = None
; focus = Int.max 0 (focus - (dimensions.height / 2))
; focus = Int.max 0 (focus - (dimensions.height / 6))
}
in
if not (focus = new_model.focus)
Expand Down
48 changes: 24 additions & 24 deletions app/capymanga/test/test_scrolling_on_search_page.ml
Original file line number Diff line number Diff line change
Expand Up @@ -144,18 +144,18 @@ let%expect_test "du" =
│ │
Capymanga powered by Mangadex / Search j Down k Up
│ │
One-Punch Man AWARD WINNING SCI-FI GORE MONSTERS ACTION COMEDY +7 tags │
After rigorously training for three years, the ordinary... │
│ │
One Punch Man (Webcomic/Original) AWARD WINNING SCI-FI SLICE OF LIFE MONSTERS ACTION COMEDY +4 tags │
Follows the life of an average part-time hero who...
DB X Saitama (Doujinshi) DOUJINSHI ACTION COMEDY SUPERHERO MARTIAL ARTS ADVENTURE +2 tags
Fan-drawn crossover of DBZ and OPM. **Links:** ...
│ │
One-Punch Man - My Student Won't Go Back Home (Doujinshi) DOUJINSHI ROMANCE SLICE OF LIFE ONESHOT GENDERSWA
One Punch Man AU, where everything is the same except...
One-Punch Man - Wash Yourself Before Entering The Bath (Doujinshi) DOUJINSHI ONESHOT COMEDY SUPERHERO
After winning a public bath voucher, Saitama wanted to... │
│ │
One-Punch Man - Because I'm a Monster (Doujinshi) DOUJINSHI THRILLER MONSTERS ACTION SUPERHERO MARTIAL AR
Fan redraw of chapter 90 of One Punch Man.
One Punch Man (Webcomic/Original) AWARD WINNING SCI-FI SLICE OF LIFE MONSTERS ACTION COMEDY +4 tags
Follows the life of an average part-time hero who...
│ │
│ │ One-Punch Man - Hatachi ni Naru Made Machinasai! (Doujinshi) DOUJINSHI ROMANCE ONESHOT COMEDY BOYS' LOVE
│ │ Saitama x Genos doujin. │
└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|}];
Handle.recompute_view handle;
Expand All @@ -169,17 +169,17 @@ let%expect_test "du" =
Capymanga powered by Mangadex / Search j Down k Up
│ │
│ │
One-Punch Man - Hatachi ni Naru Made Machinasai! (Doujinshi) DOUJINSHI ROMANCE ONESHOT COMEDY BOYS' LOVE
Saitama x Genos doujin. │
│ │
One-Punch Man - The Fight of Gods (Doujinshi) DOUJINSHI SCI-FI MONSTERS ACTION SUPERHERO MARTIAL ARTS +
A fanmade comic by Cminglap, depicting Saitama vs a... │
DB X Saitama (Doujinshi) DOUJINSHI ACTION COMEDY SUPERHERO MARTIAL ARTS ADVENTURE +2 tags │
Fan-drawn crossover of DBZ and OPM. **Links:** ... │
│ │
One-Punch Man - Saitama in the One Piece Universe (Doujinshi) DOUJINSHI MONSTERS ACTION LONG STRIP COMEDY
One-Punch Man - Wash Yourself Before Entering The Bath (Doujinshi) DOUJINSHI ONESHOT COMEDY SUPERHERO
After winning a public bath voucher, Saitama wanted to... │
│ │
One Punch Man (Webcomic/Original) AWARD WINNING SCI-FI SLICE OF LIFE MONSTERS ACTION COMEDY +4 tags │
Follows the life of an average part-time hero who... │
│ │
│ │ One-Punch Man - Shikin Kyori (Doujinshi) DOUJINSHI ROMANCE ONESHOT BOYS' LOVE SUPERHERO
│ │ Saitama x Genos douijn.
│ │ One-Punch Man - My Student Won't Go Back Home (Doujinshi) DOUJINSHI ROMANCE SLICE OF LIFE ONESHOT GENDERSWA
│ │ One Punch Man AU, where everything is the same except...
└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|}];
Handle.recompute_view handle;
Expand All @@ -192,18 +192,18 @@ let%expect_test "du" =
│ │
Capymanga powered by Mangadex / Search j Down k Up
│ │
│ │ One Punch Man (Webcomic/Original) AWARD WINNING SCI-FI SLICE OF LIFE MONSTERS ACTION COMEDY +4 tags │
│ │ Follows the life of an average part-time hero who... │
│ │
One-Punch Man - My Student Won't Go Back Home (Doujinshi) DOUJINSHI ROMANCE SLICE OF LIFE ONESHOT GENDERSWA
One Punch Man AU, where everything is the same except...
DB X Saitama (Doujinshi) DOUJINSHI ACTION COMEDY SUPERHERO MARTIAL ARTS ADVENTURE +2 tags
Fan-drawn crossover of DBZ and OPM. **Links:** ... │
│ │
One-Punch Man - Because I'm a Monster (Doujinshi) DOUJINSHI THRILLER MONSTERS ACTION SUPERHERO MARTIAL AR
Fan redraw of chapter 90 of One Punch Man.
One-Punch Man - Wash Yourself Before Entering The Bath (Doujinshi) DOUJINSHI ONESHOT COMEDY SUPERHERO
After winning a public bath voucher, Saitama wanted to...
│ │
One-Punch Man - Hatachi ni Naru Made Machinasai! (Doujinshi) DOUJINSHI ROMANCE ONESHOT COMEDY BOYS' LOVE
Saitama x Genos doujin.
One Punch Man (Webcomic/Original) AWARD WINNING SCI-FI SLICE OF LIFE MONSTERS ACTION COMEDY +4 tags
Follows the life of an average part-time hero who...
│ │
One-Punch Man - My Student Won't Go Back Home (Doujinshi) DOUJINSHI ROMANCE SLICE OF LIFE ONESHOT GENDERSWA
One Punch Man AU, where everything is the same except... │
└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|}]
;;
Expand Down
7 changes: 2 additions & 5 deletions lib/capytui/tui/scroller/test/test_capytui_scroller.ml
Original file line number Diff line number Diff line change
Expand Up @@ -635,9 +635,7 @@ let%expect_test "Testing the injection function" =
handle
[ Inject (Scroll_to { top = 100; bottom = 300 }) ];
Handle.show handle;
(* NOTE: When the range is bigger than the viewport we go to the bottom.
Not totally sure if this is ideal in all situations though at least
there is a test showing this... *)
(* NOTE: When the range is bigger than the viewport we go to the bottom. Not totally sure if this is ideal in all situations though at least there is a test showing this... *)
[%expect
{|
┌────────────────────────────────────────┐
Expand All @@ -656,8 +654,7 @@ let%expect_test "Testing the injection function" =
handle
[ Inject (Scroll_to { top = 100; bottom = 300 }) ];
Handle.show handle;
[%expect
{|
[%expect {|
┌────────────────────────────────────────┐
│ │
│ │
Expand Down

0 comments on commit 0a419de

Please sign in to comment.