Skip to content
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

Reset sequence switches background to highlighted #64

Closed
AlexisGofman opened this issue Aug 7, 2019 · 5 comments
Closed

Reset sequence switches background to highlighted #64

AlexisGofman opened this issue Aug 7, 2019 · 5 comments
Milestone

Comments

@AlexisGofman
Copy link

While using the black color scheme, the SGR 'reset' parameter 0 turns the background of all following lines to white.

As an example, this line:
\033[1mLast segment %d (task index %d) completed: %s\033[0m
Gets turned into:
</span><span style="color:white;font-weight:bold;">Last segment 0 (task index 2) completed: Succeeded!</span><span style="color:white;"></span><span style="color:white;background-color:white;">

I'm by no mean well versed in those things, but I've looked into it a little and I believe this is caused by some of the content of the background color array having the wrong index.

@theZiz
Copy link
Owner

theZiz commented Sep 19, 2019

I am having a look at this now.

@theZiz
Copy link
Owner

theZiz commented Sep 19, 2019

I can't reproduce with the most recent version of aha.
When I am doing this:

echo -e "Meow\n\033[1mLast segment %d (task index %d) completed: %s\033[0m\nMeow" | ./aha -b

I am getting this result:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!-- This file was created with the aha Ansi HTML Adapter. https://github.com/theZiz/aha -->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="application/xml+xhtml; charset=UTF-8"/>
<title>stdin</title>
</head>
<body style="color:white; background-color:black">
<pre>
Meow
<span style="font-weight:bold;">Last segment %d (task index %d) completed: %s</span>
Meow
</pre>
</body>
</html>

So the most recent version does already fix your problem or I didn't understand it at all. 😅

You can easily test the most recent version by download from this repository and build yourself by just typing make and then call aha with ./aha to use the local version.

@theZiz theZiz added this to the Release 0.5.1 milestone Sep 19, 2019
@AlexisGofman
Copy link
Author

Thanks for having a look. I found a way to reproduce the error, including with the latest version, using part of a log file my system generate : test_file.txt
I run: aha -b -f test_file.txt
And it outputs:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!-- This file was created with the aha Ansi HTML Adapter. https://github.com/theZiz/aha -->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="application/xml+xhtml; charset=UTF-8" />
<title>test_file.txt</title>
</head>
<body style="color:white; background-color:black">
<pre>
[/topological_graph_planner INFO 1568883670.939314]: Planner reset! (Initial vertex: initial_vertex, initial vertex edges: [], target vertex: target_vertex, target vertex edges: [])
[/navigation/navigation_manager INFO 1568883670.991375]: <span style="font-weight:bold;">New plan received: [1800005219900140044: shelf_reposition, 0: stop]</span><span style="color:white;"></span><span style="color:white;background-color:white;">
[/navigation/navigation_manager INFO 1568883671.000147]: Plan optimized. Modified tasks: approximate: 0, give-way-to-ctrl: 0, stop-if-dockable: 0
</span>
</pre>
</body>
</html>```

I'm not sure whether the flags are right in my file, since I can't seem to display them properly. Maybe something upstream is messing them up, in which case I apologise for bothering :)

@bhaak
Copy link
Contributor

bhaak commented Nov 3, 2019

You can easily reproduce the wrong behavior with echo "\e[39mdefault foreground \e[49mdefault background" | aha -b -n.

aha was incorrectly treating SGR 39 and 49 as fixed colors and set them to color 9 instead of resetting the color back to the default value.

I opened PR #67 for this.

@theZiz
Copy link
Owner

theZiz commented Nov 14, 2019

Thank you for giving me an example, figuring out the error and fixing this! 😃

@theZiz theZiz closed this as completed Nov 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants