-
Notifications
You must be signed in to change notification settings - Fork 97
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
Handle carriage returns #73
Comments
Hi - yes, I made that decision a while ago. It was easier to implement. I will think about what will be required to handle this. Thanks for opening this issue. |
Ok, I have reviewed this issue. This would be a big change. When I started ansi_up, I tried to primarily address log output that had ansi sequences. In addition, it mostly side steps the whole buffering issue. One of the big problems that I kept facing during the history of this project was the fact that output streams are byte oriented. I tried to ignore it, but it kept coming back as corner cases. The big challenge is this. If we have to start changing html that was already output, the complexity goes up a level. It still isn't as complex as building a terminal emulator, but it takes a big step in that direction. Lets cover some of the possible strategies. Start returning non-html data. The data would have to indicate that (XYZ) changed. This is complicated because I output data as quickly as it comes in. Another strategy is to just have ansi_up take over the rendering. This is a huge shift in responsibility. I suspect many users have as many different UI frameworks. Playing nicely with all of those and providing all the config options would be a lot of work. This would be the 'effectively turn ansi_up into a terminal emulator' option. Both of these increase the complexity and are a major API change. |
I agree that having to keep track of XY positions of everything would be hard (and error-prone). What if we only kept track of the lines though? For instance, we could have an I don't think that we have to change the As much as I think this would work, it would start to fall apart if you wanted to handle the backspace ( Ultimately it is up to you to decide which method best suits you and the direction you want to steer the project. I think we can both agree that keeping things simpler is better, but how we achieve that is up for debate. |
I think this is an interesting direction. Thanks for this suggestion. |
Ok - just a quick update. I pushed out a maintenance release to address other issues. |
Hi - this is a big change right now, and I don't have the bandwidth. |
some notes on columns (one other thing to consider) I was looking at some of my old terminal emulator code yesterday. typical terminal aware output either avoids the last column (example: a progress bar), If this feature is implemented, it will not auto wrap. I just think I will have to mention it up front in the documentation. |
At this point, the only thing to do is to figure out the protocol between ansi_up and its caller. |
This will go into the next major release with the module change since both are big changes. |
hi, I think this feature is important , what's the progress, thank you |
@ruhuansanmei - there is no progress or work happening on this. |
This is probably the best client-side library for rendering ANSI escape codes client-side, but one of the features that would be really nice to have is the ability to support carriage returns, since I am using it to stream terminal output.
When running the following Python code:
A single
9
is printed at the end, since the carriage return moves the cursor to the start of the line and eachprint
overrides the last line.The equivalent code in ansi_up doesn't do the same thing though:
When running this you get:
I would imagine this could be implemented by popping the last HTML element, that or adding a new element with a relative vertical position (and making sure to set the background so the last line doesnt bleed through). I wouldn't mind implementing this myself, but I might need a few pointers on where to start.
Thanks!
The text was updated successfully, but these errors were encountered: