# Terminaal - cursor position

**URL:** <https://discourse.julialang.org/t/terminaal-cursor-position/78783>\
**Category:** General Usage\
**Tags:** question\
**Created:** [March 31, 2022, 6:29am UTC](https://discourse.julialang.org/t/terminaal-cursor-position/78783 "2022-03-31T06:29:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![FedeClaudi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fedeclaudi/32/33490_2.png) [@FedeClaudi](https://discourse.julialang.org/u/FedeClaudi)\
**Post date:** [March 31, 2022, 6:29am UTC](https://discourse.julialang.org/t/terminaal-cursor-position/78783/1 "2022-03-31T06:29:51Z")

</div>

Hey everyone,

The way progressbars [will be rendered](https://github.com/FedeClaudi/Term.jl/blob/pbar/src/progress.jl) by [Term.jl](https://github.com/FedeClaudi/Term.jl), I need to be moving the cursor in the terminal around, do some stuff and then restore its position. All of this is done by printing [ANSI codes](https://en.wikipedia.org/wiki/ANSI_escape_code).

Now, my problem is that when I restore the cursor I need to put it on a different line from where it originally was, but on the same colon. This means I can’t just save/restore the position with `\e[s` and `\e[u`, but rather I need to use something like `\e[6n` to get the position and then extract the column information. But I can’t get this to work, I can’t find a way to _capture_ the position information transmitted by `\e[6n`.

I’ve tried writing to `stdout` and reading bites from `sdtin` or using a `IOBuffer` object but nothing works, instead of reading bytes with the position information I just read `\e[6n` as bytes.

I’ve seen [this](https://github.com/kdheepak/Presentation.jl/issues/2) and have tried [Ansillaryjl](https://docs.juliahub.com/Ansillary/1gK1V/0.1.0/) and they both work in the repl, but I can’t get them to work if I run stuff in a `.jl` file.

Any idea? Anyone that got this to work?
