Report the correct print location in the console #19
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.
Fixes Textualize/textual#3237I'm undecided about this. It doesn't feel quite right to special-case this, but on the other handprint
is a form of logging that seems to work differently in Textual vs the normal logging facility (which seems to do its own dance to handle the call location, before it makes it to devtools).This does correct the issue, this does ensure thatprint
reports the location the same as anyself.log
call. So this is a commit made to solicit more detail on the design decisions in the core of Textual.Sets us up to fix Textualize/textual#3237
This PR allows the caller to pass in a frame that should be considered to be the current frame, for the purposes of working out the location of the original log/print. This change alone won't fix Textualize/textual#3237 but provides what's needed for a change to Textual that will allow fixing it.
IMPORTANT: If this is an acceptable approach, this code should be merged into
textual-dev
and published first. There is a corresponding PR for Textual itself that should only be merged and used after this version oftextual-dev
is available and able to be used. This PR is backward-compatible so should not cause problems for any existing developer-installations of Textual.