Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Reqest] Get cursor position #38

Closed
Zooce opened this issue Nov 8, 2019 · 2 comments
Closed

[Feature Reqest] Get cursor position #38

Zooce opened this issue Nov 8, 2019 · 2 comments

Comments

@Zooce
Copy link

Zooce commented Nov 8, 2019

I'm running into an issue where '\r' is being mapped to '\n' when running a program in urxvt via Cygwin. My idea to work around this is to just set the cursor position to column 0 of the current line. However, I can't get the current line with console.

Ideal usage:

let mut term = console::Term::stdout();
let (_, y) = term.get_cursor_pos()?;
term.move_cursor_to(0, y)?;

Possible Alternatives:

  1. Add move_cursor_left and move_cursor_right. This complements the already existing functions move_cursor_up and move_cursor_down. Although in the use case I'm talking about, there's still extra work the caller has to do if they want to move "all the way" left or right.
  2. For convenience add, move_cursor_to_start and move_cursor_to_end (or something similar). Not sure on the naming here, but the idea would be to have functions that move the cursor either to the very beginning of the current line or the very end.
@pnmtjonahen
Copy link
Contributor

See my PR

@pksunkara
Copy link
Collaborator

Merged the PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants