-
Notifications
You must be signed in to change notification settings - Fork 105
add TerminalWriter.chars_on_current_line read-only property #155
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
Merged
RonnyPfannschmidt
merged 1 commit into
pytest-dev:master
from
nicoddemus:terminal-chars-per-line-count
Nov 10, 2017
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this breaks in combination with
reline
and_lastlen
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True, thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm not sure what to do here. Here's
reline
implementation:It always ends up with a
\r
, so the cursor is at the start of the line; anything you write afterwards will begin from there, but it seems there are more characters on the line. What shouldchars_on_current_line
return in this case?And notice that
reline
always expects that it will be called multiple times for the same line only. IOW, if we want to write a "collecting" message using reline, we can only callreline()
and neverwrite()
otherwise things will get out of sync.As an exercise, what should be the value of
chars_on_current_line
at the end of this code:0
or6
?Note that the "cursor" is at the beginning of the line because of the
\r
added byreline()
at this point, so if we now write:We end up with
fooest
on the terminal (this is why I mention that the onlywrite()
which produces correct result afterreline()
iswrite('\n')
).Hmm perhaps the property should be named
line_cursor_position
or something to avoid ambiguity?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if its hard to exlain it might be a bad idea
im under the impression we are trying something at the wrong abstraction level and i'd like to avoid sinking too much time into terminalwriter
in addition we are currently spagettifying multiple concepts - we should take a step back and make what we need and what boundaries those need to have
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps we should just drop the idea of messing with
TerminalWriter
and leave the hack in pytest-dev/pytest#2858?Alternatively, we might just leave
reline
as it is.reline()
is not really used in pytest or xdist, so this patch as it stands is enough for my needs in pytest-dev/pytest#2858.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can leave it as is heren but then
please document it as broken interaction and open a help wanted ticket to fix the interaction later on
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good, done: #164
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for the BTS preps, for pedantic-ness, please add a todo comment with a short description and a link to that issue