Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 29 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
uses: actions/checkout@v4
- name: Use Node.js 18.x
uses: actions/setup-node@v3
with:
Expand All @@ -27,7 +25,7 @@ jobs:
name: Format/Credo
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Elixir
uses: erlef/setup-beam@v1
with:
Expand All @@ -45,11 +43,37 @@ jobs:
run: mix format --check-formatted
- name: Run Credo
run: mix credo
dialyzer:
name: Dialyzer
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Elixir
uses: erlef/setup-beam@v1
with:
elixir-version: "1.19"
otp-version: "28"
- name: Restore dependencies cache
uses: actions/cache@v3
with:
path: deps
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}
restore-keys: ${{ runner.os }}-mix-
- name: Restore dialyzer cache
uses: actions/cache@v3
with:
path: priv/plts
key: ${{ runner.os }}-mix-plts-${{ hashFiles('./priv/plts/') }}
restore-keys: ${{ runner.os }}-mix-plts-
- name: Install dependencies
run: mix deps.get
- name: Run dialyzer
run: mix dialyzer
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Elixir
uses: erlef/setup-beam@v1
with:
Expand Down
35 changes: 17 additions & 18 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,56 +2,55 @@

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## v0.5.1 - 2026-02-22
## [0.5.1] - 2026-02-22

**Added**
### Added

- Better documented typespecs. ([#11](https://github.com/codedge-llc/pane/pull/11))
- More tests for `Pane.Page` and `Pane.Viewer`. ([#11](https://github.com/codedge-llc/pane/pull/11))
- Better documented typespecs.
- Unit tests for `Pane.Page` and `Pane.Viewer`.

**Fixed**
### Fixed

- Terminal size detection on Windows (replaced `tput` with `:io.rows/0`).
([#11](https://github.com/codedge-llc/pane/pull/11))

## v0.5.0 - 2024-08-31
## [0.5.0] - 2024-08-31

**Changed**
### Changed

- Various documentation updates ([#5](https://github.com/codedge-llc/pane/pull/5)).
- Bumped minimum Elixir version to 1.13.

## v0.4.1 - 2021-02-27
## [0.4.1] - 2021-02-27

**Fixed**
### Fixed

- Include `:iex` in `:extra_applications` to remove compile warning.

## v0.4.0 - 2020-09-28
## [0.4.0] - 2020-09-28

**Changed**
### Changed

- Bump minimum Elixir version to 1.5.

**Fixed**
### Fixed

- Remove deprecated compile warnings.

## v0.3.0 - 2018-01-18
## [0.3.0] - 2018-01-18

- Support for (f)first and (l)last page

## v0.2.0 - 2018-01-03
## [0.2.0] - 2018-01-03

- Prompt to enable ANSI codes if disabled

## v0.1.1 - 2017-03-16
## [0.1.1] - 2017-03-16

- Fix: crash on invalid key command

## v0.1.0 - 2017-02-26
## [0.1.0] - 2017-02-26

- Initial release
10 changes: 5 additions & 5 deletions lib/pane/viewer.ex
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
defmodule Pane.Viewer do
@moduledoc false

defstruct pages: [], total_pages: 0, index: 0
defstruct index: 0, pages: [], total_pages: 0

use GenServer

@type t :: %__MODULE__{
index: non_neg_integer(),
pages: [Pane.Page.t()],
total_pages: non_neg_integer(),
index: non_neg_integer()
total_pages: non_neg_integer()
}

@default_max_lines 50
Expand Down Expand Up @@ -39,13 +39,13 @@ defmodule Pane.Viewer do
iex> Pane.Viewer.init(data: "test")
{:ok, %Pane.Viewer{
index: 0,
total_pages: 1,
pages: [
%Pane.Page{
data: "test",
index: 0
}
]
],
total_pages: 1
}}
"""
def init(opts) do
Expand Down