Irssi core bugs

Notice: Undefined index: tasklist_type in /var/www/ : eval()'d code on line 85 Notice: Undefined index: tasklist_type in /var/www/ : eval()'d code on line 90
  • Status Unconfirmed
  • Percent Complete
  • Task Type Bug Report
  • Category core
  • Assigned To No-one
  • Operating System Linux
  • Severity Low
  • Priority Normal
  • Reported Version irssi 0.8.15
  • Due in Version Undecided
  • Due Date Undecided
  • Votes 0
  • Private No
Attached to Project: Irssi core bugs
Opened by bswolf (Zannick) - 2014-01-31

FS#911 - hilight-text improperly restores previous color

The hilight algorithm inserts color control codes to turn the desired text into the hilight color. Unfortunately, in retrieving what it thinks is the previous color control code, it ignores several codes (such as ^o (15) which resets colors). Thus, when in the presence of another script or a specially-formatted message (eg. from a bot that reports commits to a repo, giving different colors for username, branch, message, etc), it restores the previously used color.


^c5color^o plain Zannick should be plain
^c5color^o plain ^c8Zannick^c5 should be plain
where "should be plain" is colored red

Examples (where a script colors other users' nicks and irssi hilights mine):,0SN8TuO

A simplistic way to fix this for ^o would be to expand the else case in strip_real_length (which is where irssi finds the last color control code) to something like

if (IS_COLOR_CODE(*str)) {
*last_color_pos = (int)(str-start);
*last_color_len = 1;
} else {
[previous stuff...]

though this will still be wrong in the general case, since some of the control characters (eg. ^b ^f ^g ^v ^7) are toggles (and they do not remove the color from the hilight, either).

I'd suggest something more complicated where the toggles are tracked, and then hilight-text adds a ^o followed by the appropriate control characters:
^bbold Zannick still bold -> ^bbold ^c8Zannick^o^b still bold

This task does not depend on any other tasks.