File tree Expand file tree Collapse file tree 6 files changed +20
-22
lines changed Expand file tree Collapse file tree 6 files changed +20
-22
lines changed Original file line number Diff line number Diff line change 1+ - Added the ability to scroll horizontally in TUI. (#12386 , @Alizter )
Original file line number Diff line number Diff line change @@ -203,13 +203,7 @@ module Message_viewer = struct
203203 `Handled
204204 | _ -> `Unhandled
205205 in
206- let mouse_handler ~x :_ ~y :_ = function
207- | `Scroll dir ->
208- vscroll ~dir ;
209- `Handled
210- | _ -> `Unhandled
211- in
212- ui |> Ui. keyboard_area keyboard_handler |> Ui. mouse_area mouse_handler
206+ ui |> Ui. keyboard_area keyboard_handler
213207 ;;
214208end
215209
Original file line number Diff line number Diff line change @@ -26,8 +26,8 @@ let scrollbar_wheel_step = 8 (* Wheel event scrolls 1/8th of the screen *)
2626let scroll visible offset ~set ~dir =
2727 let dir =
2828 match dir with
29- | `Down -> 1
30- | `Up -> - 1
29+ | `Down | `Right -> 1
30+ | `Up | `Left -> - 1
3131 in
3232 set (offset + (dir * max 1 (visible / scrollbar_wheel_step)))
3333;;
@@ -153,12 +153,14 @@ let make (state_var : State.t Lwd.var) t =
153153 and + size = Lwd. get state_var in
154154 (* Render final box *)
155155 let box, vscroll, hscroll = compose_bars ui size in
156- let hscroll ~dir =
157- hscroll
158- ~dir:
159- (match dir with
160- | `Right -> `Down
161- | `Left -> `Up )
156+ let mouse_handler ~x :_ ~y :_ = function
157+ | `Scroll ((`Up | `Down ) as dir ) ->
158+ vscroll ~dir ;
159+ `Handled
160+ | `Scroll ((`Left | `Right ) as dir ) ->
161+ hscroll ~dir ;
162+ `Handled
163+ | _ -> `Unhandled
162164 in
163- { ui = measure_size box; vscroll; hscroll }
165+ { ui = measure_size box |> Ui. mouse_area mouse_handler ; vscroll; hscroll }
164166;;
Original file line number Diff line number Diff line change @@ -641,7 +641,7 @@ module Unescape = struct
641641 | `Function of int
642642 ]
643643
644- type button = [ `Left | `Middle | `Right | `Scroll of [ `Up | `Down ] ]
644+ type button = [ `Left | `Middle | `Right | `Scroll of [ `Up | `Down | `Left | `Right ] ]
645645
646646 type mods = [ `Meta | `Ctrl | `Shift ] list
647647
@@ -725,9 +725,9 @@ module Unescape = struct
725725 | 0 -> `Left
726726 | 1 when bit 6 p -> `Scroll `Down
727727 | 1 -> `Middle
728- | 2 when bit 6 p -> `ALL (* ` Scroll `Left *)
728+ | 2 when bit 6 p -> `Scroll `Left
729729 | 2 -> `Right
730- | 3 when bit 6 p -> `ALL (* ` Scroll `Right *)
730+ | 3 when bit 6 p -> `Scroll `Right
731731 | _ -> `ALL
732732 and drag = bit 5 p
733733 and mods =
Original file line number Diff line number Diff line change @@ -464,7 +464,7 @@ module Unescape : sig
464464 ]
465465 (* * A selection of extra keys on the keyboard. *)
466466
467- type button = [ `Left | `Middle | `Right | `Scroll of [ `Up | `Down ] ]
467+ type button = [ `Left | `Middle | `Right | `Scroll of [ `Up | `Down | `Left | `Right ] ]
468468 (* * Mouse buttons. *)
469469
470470 type mods = [ `Meta | `Ctrl | `Shift ] list
@@ -510,7 +510,8 @@ module Unescape : sig
510510
511511 {b Note} Every [`Press (`Left|`Middle|`Right)] generates a corresponding
512512 [`Release], but there is no portable way to detect which button was
513- released. [`Scroll (`Up|`Down)] presses are not followed by releases.
513+ released. [`Scroll (`Up|`Down|`Left|`Right)] presses are not followed
514+ by releases.
514515
515516 }
516517 {- [`Paste (`Start|`End)] are {e bracketed paste} events, signalling the
Original file line number Diff line number Diff line change 11#! /bin/bash
22
3- version=83aad282853bc35564114db72b65a087acf82ccf
3+ version=54b14f0dc25316a5b64206c55598442ec9d43325
44
55set -e -o pipefail
66
You can’t perform that action at this time.
0 commit comments