question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Terminal.get_location() coordinates do not match Terminal.move() coordinates

See original GitHub issue

I’m using blessed 1.14.1. The x and y-values returned by Terminal.get_location() are one greater than the values needed for Terminal.move() to put the cursor at that location.

Example:

import blessed

def move_and_report(row=0, col=0):
    term = blessed.Terminal()
    print(term.move(row, col), end='', flush=True)
    y, x = term.get_location()
    print('o <-- y, x: {}, {}'.format(y, x), end='', flush=True)

blessed-get-location-bug2

get_location docstring indicates this is not the intended behavior:

        """The ``(row, col)`` return value matches the parameter order of the
        ``move`` capability, so that the following sequence should cause the
        cursor to not move at all::
            >>> term = Terminal()
            >>> term.move(*term.get_location()))"""

Somewhat related to issue #65

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
avylovecommented, Sep 1, 2019

It seems like the %i in u6 is being ignored. According to this, if %i is present in u6, the values should be decremented. I’m not seeing anywhere in the code that’s happening.

# The cursor position report (<u6>) string must contain two scanf(3)-style 
# %d format elements.  The first of these must correspond to the Y coordinate
# and the second to the %d.  If the string contains the sequence %i, it is
# taken as an instruction to decrement each value after reading it (this is
# the inverse sense from the cup string).  The typical CPR value is
# \E[%i%d;%dR (on VT100/ANSI/ECMA-48-compatible terminals).
0reactions
jquastcommented, Jan 16, 2020

thanks again @avylove, I’ve added to changelog

Read more comments on GitHub >

github_iconTop Results From Across the Web

Terminal.get_location() coordinates do not match ... - GitHub
I'm using blessed 1.14.1 . The x and y-values returned by Terminal.get_location() are one greater than the values needed for Terminal.move() ...
Read more >
Get User's Current Location / Coordinates - Stack Overflow
To get a user's current location you need to declare: let locationManager = CLLocationManager(). In viewDidLoad() you have to instantiate the ...
Read more >
adb - A way to get location coordinates from command line
Looks like there is a way: adb shell dumpsys location > dumpsys.txt. This will give you a file with all location service information....
Read more >
React Native geolocation: A complete tutorial - LogRocket Blog
Explore geolocation in React Native using the react-native-geolocation-service library and build an app that fetches user coordinates.
Read more >
Find Terminal Coordinates, Given a Bearing and a Distance
The shortest distance between two points on the surface of a sphere is an arc, not a straight line. (Try this using a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found