mirror of
https://github.com/chshersh/github-tui.git
synced 2024-08-16 14:00:30 +03:00
Don't redraw the view on exit
This commit is contained in:
parent
063b01a111
commit
3e8b21dcec
@ -11,6 +11,7 @@ type tab =
|
|||||||
| PullRequests
|
| PullRequests
|
||||||
|
|
||||||
type t = {
|
type t = {
|
||||||
|
exit : bool;
|
||||||
width : int;
|
width : int;
|
||||||
height : int;
|
height : int;
|
||||||
repo : string;
|
repo : string;
|
||||||
@ -31,6 +32,7 @@ let initial_model { repo; root_dir_path; files; width; height } =
|
|||||||
width;
|
width;
|
||||||
height;
|
height;
|
||||||
repo;
|
repo;
|
||||||
|
exit = false;
|
||||||
current_tab = Code;
|
current_tab = Code;
|
||||||
code_tab = { root_dir_path; fs = Fs.zip_it files };
|
code_tab = { root_dir_path; fs = Fs.zip_it files };
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,8 @@ let update event (model : Model.t) =
|
|||||||
match event with
|
match event with
|
||||||
(* if we press `q` or the escape key, we exit *)
|
(* if we press `q` or the escape key, we exit *)
|
||||||
| Event.KeyDown ((Key "q" | Escape), _modifier) ->
|
| Event.KeyDown ((Key "q" | Escape), _modifier) ->
|
||||||
(model, Command.(Seq [ Exit_alt_screen; Show_cursor; Quit ]))
|
( { model with exit = true },
|
||||||
|
Command.(Seq [ Exit_alt_screen; Show_cursor; Quit ]) )
|
||||||
(* if we press a digit, we switch to the corresponding tab *)
|
(* if we press a digit, we switch to the corresponding tab *)
|
||||||
| Event.KeyDown (Key "1", _modifier) ->
|
| Event.KeyDown (Key "1", _modifier) ->
|
||||||
({ model with current_tab = Model.Code }, Command.Noop)
|
({ model with current_tab = Model.Code }, Command.Noop)
|
||||||
|
@ -42,4 +42,5 @@ let to_doc (model : Model.t) =
|
|||||||
empty;
|
empty;
|
||||||
]
|
]
|
||||||
|
|
||||||
let view (model : Model.t) = model |> to_doc |> Pretty.render ~width:model.width
|
let view (model : Model.t) =
|
||||||
|
if model.exit then "" else model |> to_doc |> Pretty.render ~width:model.width
|
||||||
|
Loading…
Reference in New Issue
Block a user