# \[ANN\] TerminalPager.jl v0.2.0

**URL:** <https://discourse.julialang.org/t/ann-terminalpager-jl-v0-2-0/61616>\
**Category:** Package Announcements\
**Created:** [May 22, 2021, 1:15am UTC](https://discourse.julialang.org/t/ann-terminalpager-jl-v0-2-0/61616 "2021-05-22T01:15:13Z")\
**Posts on this page:** 19\
**Page:** 2

<div class="post-metadata">

**Author:** ![ctkelley](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ctkelley/32/10684_2.png) [@ctkelley](https://discourse.julialang.org/u/ctkelley)\
**Post date:** [May 23, 2021, 5:37pm UTC](https://discourse.julialang.org/t/ann-terminalpager-jl-v0-2-0/61616/21 "2021-05-23T17:37:42Z")

</div>

Great package. @help alone is worth a lot.

I tried @rafael.guerra example with freeze rows/columns and it did not work for me either.

---

<div class="post-metadata">

**Author:** ![Ronis\_BR](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ronis_br/32/50999_2.png) [@Ronis\_BR](https://discourse.julialang.org/u/Ronis_BR)\
**Post date:** [May 23, 2021, 5:53pm UTC](https://discourse.julialang.org/t/ann-terminalpager-jl-v0-2-0/61616/22 "2021-05-23T17:53:21Z")

</div>

Thanks!!

Hum, very strange. Can you please try another value like 10?

---

<div class="post-metadata">

**Author:** ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Post date:** [May 23, 2021, 5:56pm UTC](https://discourse.julialang.org/t/ann-terminalpager-jl-v0-2-0/61616/23 "2021-05-23T17:56:09Z")

</div>

@Ronis_BR, sorry, misunderstood you on the larger test.  
Editing this same post to not overcrowd this thread.

**Win10:**  
Tried a 10 rows x 10 columns freeze and got a table in the REPL that took forever to print the updates and had to kill the REPL.

**Linux on Android cellphone:**  
Tried a 3 rows x 3 columns freeze, and got a few digits of freeze on first column, and 2 rows of freeze at top.

---

<div class="post-metadata">

**Author:** ![Ronis\_BR](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ronis_br/32/50999_2.png) [@Ronis\_BR](https://discourse.julialang.org/u/Ronis_BR)\
**Post date:** [May 23, 2021, 6:15pm UTC](https://discourse.julialang.org/t/ann-terminalpager-jl-v0-2-0/61616/24 "2021-05-23T18:15:20Z")

</div>

> [@rafael.guerra](#):
>
> 10 was too small number to page but tried 15 and TP won’t freeze.

I did not understand. Is there a way to post a video or something? Look what I get:

![Gravação de Tela 2021-05-23 às 15.13.19](https://global.discourse-cdn.com/julialang/original/3X/4/8/48b7054137a3e95fa26753c1c2f85b2b9fff07c8.gif)

> [@rafael.guerra](#):
>
> **NB:** is there any cross-talk with PrettyTables? Latest version used 1.0.1

No there is not. TerminalPager.jl does not depend on PrettyTables.

EDIT: By the way, the number in freeze rows and columns are the number of text rows and text columns, and not the number of rows in a matrix, for example.

---

<div class="post-metadata">

**Author:** ![Ronis\_BR](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ronis_br/32/50999_2.png) [@Ronis\_BR](https://discourse.julialang.org/u/Ronis_BR)\
**Post date:** [May 23, 2021, 6:41pm UTC](https://discourse.julialang.org/t/ann-terminalpager-jl-v0-2-0/61616/26 "2021-05-23T18:41:05Z")

</div>

> [@rafael.guerra](#):
>
> **Win10:**  
> Tried a 10 rows x 10 columns freeze and got a table in the REPL that took forever to print the updates and had to kill the REPL.
> 
> **Linux on Android cellphone:**  
> Tried a 3 rows x 3 columns freeze, and got a few digits of freeze on first column, and 2 rows of freeze at top.

I just do not have a Windows machine here to test. Maybe we need more tweaking.

The result in Android is expected. Notice that rows and columns are related to text rows and text columns.

---

<div class="post-metadata">

**Author:** ![ctkelley](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ctkelley/32/10684_2.png) [@ctkelley](https://discourse.julialang.org/u/ctkelley)\
**Post date:** [May 23, 2021, 6:42pm UTC](https://discourse.julialang.org/t/ann-terminalpager-jl-v0-2-0/61616/27 "2021-05-23T18:42:45Z")

</div>

> [@Ronis\_BR](#):
>
> EDIT: By the way, the number in freeze rows and columns are the number of text rows and text columns, and not the number of rows in a matrix, for example.

OK. I think I understand what I’m supposed to see. freeze would be more useful if it knew about rows and columns. As it is, it is hard to get much out of it with a matrix of floating point numbers without counting the characters.

---

<div class="post-metadata">

**Author:** ![ctkelley](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ctkelley/32/10684_2.png) [@ctkelley](https://discourse.julialang.org/u/ctkelley)\
**Post date:** [May 23, 2021, 6:45pm UTC](https://discourse.julialang.org/t/ann-terminalpager-jl-v0-2-0/61616/28 "2021-05-23T18:45:29Z")

</div>

I don’t know how I did without @help.

Welcome to my `startup.jl` file.

---

<div class="post-metadata">

**Author:** ![Ronis\_BR](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ronis_br/32/50999_2.png) [@Ronis\_BR](https://discourse.julialang.org/u/Ronis_BR)\
**Post date:** [May 23, 2021, 6:49pm UTC](https://discourse.julialang.org/t/ann-terminalpager-jl-v0-2-0/61616/29 "2021-05-23T18:49:51Z")

</div>

> [@ctkelley](#):
>
> OK. I think I understand what I’m supposed to see. freeze would be more useful if it knew about rows and columns. As it is, it is hard to get much out of it with a matrix of floating point numbers without counting the characters.

This feature is mainly designed for packages. For example, in DataFrames, we know the size of the header and the column with the row numbers. Hence, we can call `pager` with the correct values. It will be extremely difficult to make pager aware of many different types to develop defaults for the freeze parameters.

> [@ctkelley](#):
>
> I don’t know how I did without @help.
> 
> Welcome to my `startup.jl` file.

Nice! I am glad it is being useful 🙂

---

<div class="post-metadata">

**Author:** ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Post date:** [May 23, 2021, 7:13pm UTC](https://discourse.julialang.org/t/ann-terminalpager-jl-v0-2-0/61616/30 "2021-05-23T19:13:52Z")

</div>

@Ronis_BR, thanks. Got it now.

The following produced a nice freezing test in both Win10 and linux on Android:

```julia
julia> DataFrame(rand(100,100),:auto) |> pager
:f
Freeze rows (0): 4
Freeze columns (0): 6

```

And then use arrow keys and other keybindings.

_ **NB:** it would be helpful to have the package doc that is available at the terminal help, also in the github package documentation._

---

<div class="post-metadata">

**Author:** ![Ronis\_BR](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ronis_br/32/50999_2.png) [@Ronis\_BR](https://discourse.julialang.org/u/Ronis_BR)\
**Post date:** [May 23, 2021, 8:58pm UTC](https://discourse.julialang.org/t/ann-terminalpager-jl-v0-2-0/61616/31 "2021-05-23T20:58:32Z")

</div>

@sijo I just pushed a commit with the REPL modes. @ctkelley if you use a lot `@help` maybe you will also like!

I **really** need help to test since it is the first time I created a REPL mode.

After `using TerminalPager`, we can type `|` to enter `pager` mode. I know this can give some problem since `|` is a valid function, but it is hardly used at the beginning of the command:

 ![Captura de Tela 2021-05-23 às 17.53.07](https://global.discourse-cdn.com/julialang/original/3X/d/8/d89a2dfe59b7f8d59625b978c078def026dbcc6a.png)

(Side note: We already have modes using green, red, and blue. Thus I took magenta 🙂)

In this case, the mode analyze everything that is printed to `stdout`, including the result of the command. If the output is larger than screen, then the pager is called. Otherwise, it is print normally:

```julia
pager> rand(3,3)

```

 ![Captura de Tela 2021-05-23 às 17.55.13](https://global.discourse-cdn.com/julialang/original/3X/f/3/f3f61a6404715c70908e6bba368051f4e262c9ac.png)

```julia
pager> rand(100, 100)

```

 ![Captura de Tela 2021-05-23 às 17.55.32](https://global.discourse-cdn.com/julialang/original/3X/8/e/8e27f81e9dc3e5bd1ea369f122fe1406abfce290.png)

In pager mode, you can also type `?` to enter in “pager help” mode. In this case, the help of the function is show just like in the mode `help?>`. The difference is that, if the output does not fit in the screen, the pager is called:

 ![Captura de Tela 2021-05-23 às 17.56.42](https://global.discourse-cdn.com/julialang/original/3X/d/9/d90382b3dfb79cb53c35f01aeec04b0dd799ac68.png)

 ![Captura de Tela 2021-05-23 às 17.56.48](https://global.discourse-cdn.com/julialang/original/3X/9/c/9c94568a9da1bf18b8aee4daf7fce379404935b1.png)

To use this features, we need `main` branch.

---

<div class="post-metadata">

**Author:** ![JackDevine](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jackdevine/32/1048_2.png) [@JackDevine](https://discourse.julialang.org/u/JackDevine)\
**Post date:** [May 24, 2021, 6:58am UTC](https://discourse.julialang.org/t/ann-terminalpager-jl-v0-2-0/61616/32 "2021-05-24T06:58:12Z")

</div>

> [@Ronis\_BR](#):
>
> Really? Everything seems right here. Can you please refresh the page?

This is what I see.

 ![image](https://global.discourse-cdn.com/julialang/original/3X/c/a/cae369c57e9d0e50c38d09e56fdd1ae7298eac6b.png)

It is probably a discourse bug, so I wouldn’t worry too much.

That was super quick to create the REPL mode! I think that REPL modes are an underutilised tool in the Julia ecosystem, just my opinion though.

---

<div class="post-metadata">

**Author:** ![Ronis\_BR](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ronis_br/32/50999_2.png) [@Ronis\_BR](https://discourse.julialang.org/u/Ronis_BR)\
**Post date:** [May 24, 2021, 1:45pm UTC](https://discourse.julialang.org/t/ann-terminalpager-jl-v0-2-0/61616/33 "2021-05-24T13:45:53Z")

</div>

> [@JackDevine](#):
>
> This is what I see.

That’s very weird… I have no idea why this is happening.

---

<div class="post-metadata">

**Author:** ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Post date:** [May 24, 2021, 2:35pm UTC](https://discourse.julialang.org/t/ann-terminalpager-jl-v0-2-0/61616/34 "2021-05-24T14:35:35Z")

</div>

@Ronis_BR, you seem to have provided the wrong picture for the code snippet in your OP. It should have been:

 ![pager_example](https://global.discourse-cdn.com/julialang/original/3X/0/d/0d3a69bf8225fe11b83715f2f605ea06d652eb5c.png)

NB: 🙂

---

<div class="post-metadata">

**Author:** ![Ronis\_BR](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ronis_br/32/50999_2.png) [@Ronis\_BR](https://discourse.julialang.org/u/Ronis_BR)\
**Post date:** [May 24, 2021, 2:36pm UTC](https://discourse.julialang.org/t/ann-terminalpager-jl-v0-2-0/61616/35 "2021-05-24T14:36:56Z")

</div>

But it is exactly what I am seeing in the documentation:

 ![Captura de Tela 2021-05-24 às 11.36.13](https://global.discourse-cdn.com/julialang/original/3X/4/1/4124463df0266c7ca4cc3eca7c95e1b40eab45fa.png)

EDIT: Ouch! Never mind, I just noticed that you are mentioning the post here instead of the documentation in Github. Sorry!! @rafael.guerra is 100% right.

---

<div class="post-metadata">

**Author:** ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Post date:** [May 24, 2021, 2:38pm UTC](https://discourse.julialang.org/t/ann-terminalpager-jl-v0-2-0/61616/36 "2021-05-24T14:38:02Z")

</div>

@Ronis_BR, yes but not in your OP above?

---

<div class="post-metadata">

**Author:** ![Ronis\_BR](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ronis_br/32/50999_2.png) [@Ronis\_BR](https://discourse.julialang.org/u/Ronis_BR)\
**Post date:** [May 24, 2021, 2:54pm UTC](https://discourse.julialang.org/t/ann-terminalpager-jl-v0-2-0/61616/37 "2021-05-24T14:54:47Z")

</div>

By the way, here is the new REPL mode in action:

[https://asciinema.org/a/nuDAsGY2vasRuQboDbBoLctlx](https://asciinema.org/a/nuDAsGY2vasRuQboDbBoLctlx)

P.S.: How I could live without knowing about Asciinema?! I think the time of my gifs in Discourse has come 😃

---

<div class="post-metadata">

**Author:** ![sijo](https://avatars.discourse-cdn.com/v4/letter/s/da6949/32.png) [@sijo](https://discourse.julialang.org/u/sijo)\
**Post date:** [May 24, 2021, 5:25pm UTC](https://discourse.julialang.org/t/ann-terminalpager-jl-v0-2-0/61616/38 "2021-05-24T17:25:15Z")

</div>

This is excellent stuff. The REPL mode is perfect to test what should (in my opinion) become the default REPL behavior.

Being used to the `less` pager, I miss a few shortcuts that I often use for scrolling: `space` and `(Ctrl+)F` for one screen forward, `(Ctrl+)B for one screen backward, `\<`and`\>`for beginning and end of document (same as`g`and`G` which are already implemented.

One issue I see: it seems the implementation renders the whole data, not just the part necessary to render the screen? It’s fine most of the time but I have problems with very large arrays: On my underpowered laptop, displaying `rand(2000, 2000)` takes ~13 seconds, and scrolling is laggy (for example, keeping the “right arrow” key pressed for 2 seconds, it starts to scroll slowly and keeps scrolling for a while after I release the key).

A feature request (maybe there already but couldn’t find it): a nice feature of the normal REPL is that when displaying a matrix too large for the screen, the four corners are shown. It doesn’t make sense to do that in pager mode, but it would be nice to have a shortcut like `g`/`G` but for the horizontal axis, to quickly check the horizontal end, and come back.

I guess I should start using your issue tracker on GitHub 🙂

Just one question: I want to make this my default. Do you know how I can enable it from the `startup.jl`?

---

<div class="post-metadata">

**Author:** ![ctkelley](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ctkelley/32/10684_2.png) [@ctkelley](https://discourse.julialang.org/u/ctkelley)\
**Post date:** [May 24, 2021, 5:33pm UTC](https://discourse.julialang.org/t/ann-terminalpager-jl-v0-2-0/61616/39 "2021-05-24T17:33:30Z")

</div>

Put this line in your startup.jl

```julia
using TerminalPager

```

That’s it. I’m not clear on what you mean by `default` however.

---

<div class="post-metadata">

**Author:** ![Ronis\_BR](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ronis_br/32/50999_2.png) [@Ronis\_BR](https://discourse.julialang.org/u/Ronis_BR)\
**Post date:** [May 24, 2021, 6:31pm UTC](https://discourse.julialang.org/t/ann-terminalpager-jl-v0-2-0/61616/40 "2021-05-24T18:31:27Z")

</div>

> [@sijo](#):
>
> This is excellent stuff. The REPL mode is perfect to test what should (in my opinion) become the default REPL behavior.

Thanks!! However we have a long, long way until I am confident to propose to merge it to `stdlib` 🙂

> [@sijo](#):
>
> Being used to the `less` pager, I miss a few shortcuts that I often use for scrolling: `space` and `Ctrl+F` for one screen forward, `Ctrl+V` for one screen backward, `<` and `>` for beginning and end of document (same as `g` and `G` which are already implemented.

The `space` should be working… anyway, it is very easy to change the key bindings, we just need to discuss the best options for everyone. Can you please open an issue listing the key bindings you want to be the default?

> [@sijo](#):
>
> One issue I see: it seems the implementation renders the whole data, not just the part necessary to render the screen? It’s fine most of the time but I have problems with very large arrays: On my underpowered laptop, displaying `rand(2000, 2000)` takes ~13 seconds, and scrolling is laggy (for example, keeping the “right arrow” key pressed for 2 seconds, it starts to scroll slowly and keeps scrolling for a while after I release the key).

It cannot lazy load anything. In fact, it is a major problem that will require a lot of work.

I was discussing in slack with @pdeffebach. It is not feasible to add support for numerous object types inside TerminalPager.jl. What we really need to do is to create some kind of interface just like we have in Tables.jl. Each type must register itself in this interface and provide API functions like `render_chunk` or something. Hence, the pager can call the chunks separately to lazy load everything.

This lazy load API will require a lot of work…

> [@sijo](#):
>
> A feature request (maybe there already but couldn’t find it): a nice feature of the normal REPL is that when displaying a matrix too large for the screen, the four corners are shown. It doesn’t make sense to do that in pager mode, but it would be nice to have a shortcut like `g` / `G` but for the horizontal axis, to quickly check the horizontal end, and come back.

You can go to the beginning and end of the line by typing `0` and `$` just like in Vim. The same functionality is also mapped to ALT + left and ALT + right, but some terminals hijack those keystrokes.

> [@sijo](#):
>
> Just one question: I want to make this my default. Do you know how I can enable it from the `startup.jl` ?

You can load TerminalPager.jl as @ctkelley said, but I have no idea how to change the REPL mode at startup ☹

[Previous page](https://discourse.julialang.org/t/ann-terminalpager-jl-v0-2-0/61616.md?page=1)
