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

Remove ANSI escape codes (bnc#921233) #10

Merged
merged 5 commits into from Jun 19, 2015

Conversation

Projects
None yet
3 participants
@ancorgs
Copy link
Contributor

commented Mar 19, 2015

No description provided.

UI.ChangeWidget(Id(:log), :LastLine, new_text) if new_text != nil
if !new_text.nil?
# Remove ANSI escape codes for cursor movement (bnc#921233)
new_text.gsub!(/\e\[(\d|;)*[HJ]/, "")

This comment has been minimized.

Copy link
@mvidner

mvidner Mar 19, 2015

Member

I think it should be a method with a name, something like scrub_terminal_escapes. Of course there are many more sequences https://en.wikipedia.org/wiki/ANSI_escape_code (notably the color codes) but I hope it is OK starting small like this.

This comment has been minimized.

Copy link
@ancorgs

ancorgs Mar 19, 2015

Author Contributor

If we include the color codes in that method, we could also use it here
https://github.com/yast/yast-yast2/blob/master/library/system/src/clients/view_anymsg.rb#L187

I know we have a Yast::String class, but AFAIK the intention is to deprecate it. Where should we put that generic method for ANSI cleaning?

This comment has been minimized.

Copy link
@mvidner

mvidner Mar 19, 2015

Member

I see. Yes, it would be nice to make it a library method but I don't want to spend much time on it :-) Yast::String really is already too big, maybe Yast::UIHelper, I don't know.

@jreidinger

This comment has been minimized.

Copy link
Member

commented May 20, 2015

@ancorgs ping what is status here?

@ancorgs

This comment has been minimized.

Copy link
Contributor Author

commented Jun 18, 2015

@jreidinger finally updated

@@ -905,7 +909,11 @@ def GenerateDialog
Builtins.sleep(100)
if SCR.Read(path(".process.running"), pid) == true
new_text = Convert.to_string(SCR.Read(path(".process.read"), pid))
UI.ChangeWidget(Id(:log), :LastLine, new_text) if new_text != nil
if !new_text.nil?

This comment has been minimized.

Copy link
@jreidinger

jreidinger Jun 19, 2015

Member

I think simple if new_text is enough in this case

@jreidinger

This comment has been minimized.

Copy link
Member

commented Jun 19, 2015

just one nitpick, otherwise lgtm

ancorgs added a commit that referenced this pull request Jun 19, 2015

Merge pull request #10 from ancorgs/clear_ansi
Remove ANSI escape codes (bnc#921233)

@ancorgs ancorgs merged commit 0d8dbf3 into yast:master Jun 19, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.