Skip to content

Commit

Permalink
feat: support alt screen
Browse files Browse the repository at this point in the history
  • Loading branch information
ALX99 committed Jun 7, 2024
1 parent 5a63750 commit 420516d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ If the file is not found, it will use the following default configuration:

```yaml
settings:
alt_screen: true
keymap:
left: "h"
up: "j"
Expand Down
7 changes: 6 additions & 1 deletion cmd/sail/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,12 @@ func main() {
os.Exit(1)
}

_, err = tea.NewProgram(models.NewMain(cwd, cfg)).Run()
var opts []tea.ProgramOption
if cfg.Settings.AltScreen {
opts = append(opts, tea.WithAltScreen())
}

_, err = tea.NewProgram(models.NewMain(cwd, cfg), opts...).Run()
if err != nil {
fmt.Fprintf(os.Stderr, "%v\n", err)
os.Exit(1)
Expand Down
4 changes: 3 additions & 1 deletion internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ type Config struct {
}

type Settings struct {
Keymap Keymap `yaml:"keymap"`
Keymap Keymap `yaml:"keymap"`
AltScreen bool `yaml:"alt_screen"`
}
type Keymap struct {
NavUp string `yaml:"up"`
Expand Down Expand Up @@ -50,6 +51,7 @@ func GetConfig() (Config, error) {
Paste: "p",
Copy: "c",
},
AltScreen: true,
},
}

Expand Down

0 comments on commit 420516d

Please sign in to comment.