donkirkby / live-py-plugin

Live coding in Python with PyCharm, Emacs, Sublime Text, or even a browser
https://donkirkby.github.io/live-py-plugin
MIT License
290 stars 57 forks source link

Is it possible to set the width of the output content? #512

Closed Prague2049 closed 1 year ago

Prague2049 commented 1 year ago

What I did

Describe the steps you took, probably including your Python code, like this:

print(42)

What happened

If the number of for cycles is relatively large, the width of the output will be very large, as if there is no scrolling to the right? Is it possible to limit the width of the output, and display the output of the extra for loop in the next few lines?

print('42') 

What I wanted to happen

Describe what you wanted, probably including changes to the live coding display, like this:

print('What do you get when you multiply six by nine?') 

My environment

Describe the versions of everything you were using:

Other feedback

While you're here, we'd love to know how you learned about the project, what you use it for, or anything else you'd like to tell us.

donkirkby commented 1 year ago

Thanks for opening an issue. Please tell me if I've misunderstood your question, but I think you're asking whether the live coding display can wrap loop iterations onto later lines.

It can't do that, and I don't plan to add that feature. One of the key ideas in the display is that a line of code and its results appear on the same line. If the results wrap to lower lines, I guess we'd have to add blank space to the source code on the left, otherwise the results from two different lines could get mixed together.

Of course, maybe I've misunderstood what you're asking for, or maybe you have a better idea for how to display it. If so, please add a comment with an example scenario and a mockup of how you think it should be displayed.

Here's an example of what I think you're asking for: a loop that doesn't fit in the window.

1) for i in range(10): | i = 0      | i = 1      | i = 2      | i = 3      | i = 4      | i = 5      |
2)     print(i)        | print('0') | print('1') | print('2') | print('3') | print('4') | print('5') |
3) print('Done.')      | print('Done.')

How it might look if we wrapped the display and left blank space in the source code:

1) for i in range(10): | i = 0      | i = 1      | i = 2      | i = 3      | i = 4      | i = 5      |
2)     print(i)        | print('0') | print('1') | print('2') | print('3') | print('4') | print('5') |
                       : i = 6      | i = 7      | i = 8      | i = 9
                       : print('6') | print('7') | print('8') | print('9')
3) print('Done.')      | print('Done.')

Is there a reason that you don't like scrolling to the right to see later iterations of the loop? You can switch to the other window and scroll as far as you like, as shown in this demo video. You can also use search and all the standard Emacs tools to find the iteration you're interested in.

If you're interested in hacking the Emacs mode to experiment with a new display, you can see the command-line arguments for space tracer. --trace_width and --trace_offset are probably what you would need.

donkirkby commented 1 year ago

Since I didn't get any response for a couple of months, I'm going to close this issue as "won't fix".

Feel free to add a comment any time, and I'll reconsider.