[Home] [Downloads] [Search] [Help/forum]

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  ansi 16 after ansi 256 ignores bold?

Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?
(New message)
Subject: ansi 16 after ansi 256 ignores bold?
Name:
Your forum user name.
Register forum user name
Password:
Your forum password.
Forgotten password?
Message:
Message to be posted (in English, please).
Forum codes:
Check this if your message uses 'forum codes' or templates (auto-detected for new posts).
Forum codes Templates

Save this message ...


Subject review (reverse sequence)

Pages: 1 2  

Posted by Fiendish   USA  (848 posts)  [Biography] bio   Global Moderator
Date Thu 20 Dec 2012 04:47 AM (UTC)  quote  ]

Amended on Thu 20 Dec 2012 04:48 AM (UTC) by Fiendish

Message
Nick Gammon said:

Changing it now could be problematic.
It might fix your problems but cause ones for others who are used to how it works now.
Currently xterm color just doesn't work. Wouldn't unifying with the other way keep the other bits working still and just make this work too?

Quote:
Why do you need to use it anyway?

I don't remember why I wanted to use it last time, but apparently I keep wanting to piece together ansi sequences without looping over colourtell. In this instance I was going to make a trigger to replace all server output with random ansi colors.

http://aardwolfclientpackage.googlecode.com/
[Go to top] top

Posted by Nick Gammon   Australia  (18,770 posts)  [Biography] bio   Forum Administrator
Date Thu 20 Dec 2012 04:17 AM (UTC)  quote  ]
Message
I'm not sure. That code was written in April 2003.

As I recall the idea of AnsiNote was to make it easy to inject ANSI sequences into your notes. However it doesn't go through the lengthy state machine that normal input (including Simulate) does. Basically the "usual" ANSI sequences were turned into the equivalent foreground/background colours. It may have bugs compared to the "main" state machine.

Judging by the release notes it was specifically written to support the Chat interface, where incoming chats had ANSI sequences in them, but were handled by scripts, and not the main "incoming MUD data" state machine.

Changing it now could be problematic. It might fix your problems but cause ones for others who are used to how it works now.

Why do you need to use it anyway?

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Fiendish   USA  (848 posts)  [Biography] bio   Global Moderator
Date Thu 20 Dec 2012 12:31 AM (UTC)  quote  ]

Amended on Thu 20 Dec 2012 12:59 AM (UTC) by Fiendish

Message
LOL. I just found this thread again. Same xterm 256 color reason. Why again does AnsiNote interpret xterm colors differently than Simulate?

http://aardwolfclientpackage.googlecode.com/
[Go to top] top

Posted by Fiendish   USA  (848 posts)  [Biography] bio   Global Moderator
Date Sat 31 Dec 2011 07:49 PM (UTC)  quote  ]
Message
Note a huge deal, I guess. I just tried using AnsiNote on 256ified data, and had to figure out the problem and then change the display method after mining the forum and re-finding this thread.

http://aardwolfclientpackage.googlecode.com/
[Go to top] top

Posted by Nick Gammon   Australia  (18,770 posts)  [Biography] bio   Forum Administrator
Date Sat 31 Dec 2011 07:20 PM (UTC)  quote  ]
Message
I am reluctant to fiddle with the colour-handling, particularly when there is code there that would do it, if it hadn't been commented out. That's a pretty sure sign that there is another subtle bug awaiting someone if it is changed.

If, when this bug was reported, there was a simple fix, I am sure I would have done the fix. As it is, I can't even remember what the bug is exactly.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Fiendish   USA  (848 posts)  [Biography] bio   Global Moderator
Date Sat 31 Dec 2011 02:32 PM (UTC)  quote  ]

Amended on Sat 31 Dec 2011 02:38 PM (UTC) by Fiendish

Message
Oh sorry. The bold thing isn't my issue right now. I guess I'm looking just at the 38;5 thing.

http://aardwolfclientpackage.googlecode.com/
[Go to top] top

Posted by Nick Gammon   Australia  (18,770 posts)  [Biography] bio   Forum Administrator
Date Sat 31 Dec 2011 04:23 AM (UTC)  quote  ]
Message
Do you actually want a bold font, or just the bolded colours?

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Fiendish   USA  (848 posts)  [Biography] bio   Global Moderator
Date Fri 30 Dec 2011 05:36 PM (UTC)  quote  ]

Amended on Fri 30 Dec 2011 08:29 PM (UTC) by Fiendish

Message
Fiendish said:

Quote:
Well first, how big an issue is this?

*shrug* :)

New answer: I just ran into this problem again because my StylesToANSI function favored 256ish equivalents for the standard 1-16 color values and I was trying to use AnsiNote instead of Simulate. I think it's weird for AnsiNote to not work the same way that Simulate does (or even in the same way that a series of consecutive ColourTells would), since re-displaying output from 256 enabled MUDs is such a useful concept.

http://aardwolfclientpackage.googlecode.com/
[Go to top] top

Posted by Twisol   USA  (2,229 posts)  [Biography] bio
Date Thu 05 May 2011 11:04 AM (UTC)  quote  ]

Amended on Thu 05 May 2011 11:12 AM (UTC) by Twisol

Message
This isn't really the place to rant, but honestly, the xterm sequences should've used an intermediate byte instead of an arcane, unusual sequence of parameters. "\e[156/m" would have made much more sense.

And just to spite the MUD gods, I'm going to implement exactly that. So nyah. >_<


(Intermediate bytes are specified in section 5.4 of the ANSI control sequence specification, found here: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-048.pdf)

[EDIT]: The unallocated bit combinations are reserved for future standardization and shall not be used.
So it doesn't want me to use "/m". Mrrrrgh. Maybe I can use one of the sequences from the private-use table... Okay, standards issues aside, it makes a lot more sense than "38;5;<x>".

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
[Go to top] top

Posted by Fiendish   USA  (848 posts)  [Biography] bio   Global Moderator
Date Thu 05 May 2011 06:09 AM (UTC)  quote  ]
Message
Quote:
Well first, how big an issue is this?

*shrug* :)

http://aardwolfclientpackage.googlecode.com/
[Go to top] top

Posted by Nick Gammon   Australia  (18,770 posts)  [Biography] bio   Forum Administrator
Date Thu 05 May 2011 04:32 AM (UTC)  quote  ]
Message
It would be done to solve a subtle bug. One I don't particularly want to re-introduce.

Well first, how big an issue is this? Whilst you have identified a bug (Fiendish) the easy work-around is to make it bold, and then change the colour. And it only shows up in the 256-ANSI mode.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Twisol   USA  (2,229 posts)  [Biography] bio
Date Thu 05 May 2011 04:21 AM (UTC)  quote  ]
Message
I just ported my ANSI parser to C++, in case you want to use it. The "MyParser" demo I wrote does pretty much everything except actually pass data/styles to the output area.

If you don't use it that's fine, I just felt like doing something in C++.

https://gist.github.com/956475

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
[Go to top] top

Posted by Twisol   USA  (2,229 posts)  [Biography] bio
Date Thu 05 May 2011 02:57 AM (UTC)  quote  ]
Message
Nick Gammon said:
But it is commented out with the note "obsolete". Now I don't take functionality away without a good reason. I can't remember what that reason was however.

The blame output for the file on GitHub doesn't show any changes to the file since you originally pushed it, so it must have been an old change. It doesn't look wrong, anyways, and it's apparently not obsolete any more, so...

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
[Go to top] top

Posted by Nick Gammon   Australia  (18,770 posts)  [Biography] bio   Forum Administrator
Date Thu 05 May 2011 02:47 AM (UTC)  quote  ]

Amended on Thu 05 May 2011 02:48 AM (UTC) by Nick Gammon

Message
Twisol said:

ANSI(38,5,9) generates a perfectly valid sequence \e[38;5;9m, and in fact you can generate any arbitrary ANSI-formatted sequence using ANSI().


Perhaps I should clarify that. It supports the *documented* codes on the ANSI help page.




Now as for switching back from RGB mode to ANSI mode - I see I had the code to do that right here (ansi.cpp line 38 onwards):


  // switch back to ANSI colour if required
/*   obsolete
  if ((iCode >= 30 && iCode <= 37) ||
      (iCode >= 40 && iCode <= 47))
    {
    // we can't mix them - if we go back to ANSI colours we have to discard
    // the RGB codes
    if ((iFlags & COLOURTYPE) == COLOUR_RGB)
      {
      iForeColour = WHITE;
      iBackColour = BLACK;     
      }
    iFlags &= ~COLOURTYPE;  // clear RGB or custom bits
    iFlags |= COLOUR_ANSI;
    }

*/


But it is commented out with the note "obsolete". Now I don't take functionality away without a good reason. I can't remember what that reason was however.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Twisol   USA  (2,229 posts)  [Biography] bio
Date Wed 04 May 2011 11:55 PM (UTC)  quote  ]

Amended on Wed 04 May 2011 11:59 PM (UTC) by Twisol

Message
Nick Gammon said:
Sigh. The full ANSI implementation is done with a state machine that has (rather complex) calculations for the bold/underline/RGB/non-RGB/xterm-256 and so on handling in it. And in a very similar vein to the Simulate, it isn't particularly easy to "inject" the AnsiNote stuff into it. Doing that is likely to change the state for the current incoming line. So AnsiNote just implements a subset of the more commonly-used codes.

Thanks. That's a lot more helpful to me. :)

IIRC, MUSHclient's ANSI implementation is built into the CMUSHClientDoc object, correct? I can definitely see how that would be a problem. If I were writing AnsiNote() for Aspect, I'd create a new ANSI parser object and run the text through it, so as to leave the original untouched.

Nick Gammon said:
And as noted, it supports the codes you can generate with the ANSI function.

ANSI(38,5,9) generates a perfectly valid sequence \e[38;5;9m, and in fact you can generate any arbitrary ANSI-formatted sequence using ANSI().

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


4,321 views.

This is page 1, subject is 2 pages long: 1 2  [Next page]

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

[Home]

Written by Nick Gammon - 5K

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Internet Contents Rating Association (ICRA) - 2K]    [Web site powered by FutureQuest.Net]