old_contents: # -*- coding: utf-8 -*-
  
  from powerline.renderer import Renderer
  from powerline.colorscheme import ATTR_BOLD, ATTR_ITALIC, ATTR_UNDERLINE
  
  
  class ShellRenderer(Renderer):
  	'''Powerline shell segment renderer.'''
  	escape_hl_start = ''
  	escape_hl_end = ''
  
  	def hlstyle(self, fg=None, bg=None, attr=None):
  		'''Highlight a segment.
  
  		If an argument is None, the argument is ignored. If an argument is
  		False, the argument is reset to the terminal defaults. If an argument
  		is a valid color or attribute, it's added to the ANSI escape code.
  		'''
  		ansi = []
  		if fg is not None:
  			if fg is False or fg[0] is False:
  				ansi += [39]
  			else:
  				if self.term_truecolor:
  					ansi += [38, 2] + list(self._int_to_rgb(fg[1]))
  				else:
  					ansi += [38, 5, fg[0]]
  		if bg is not None:
  			if bg is False or bg[0] is False:
  				ansi += [49]
  			else:
  				if self.term_truecolor:
  					ansi += [48, 2] + list(self._int_to_rgb(bg[1]))
  				else:
  					ansi += [48, 5, bg[0]]
  		if attr is not None:
  			if attr is False:
  				ansi += [22]
  			else:
  				if attr & ATTR_BOLD:
  					ansi += [1]
  		return self.escape_hl_start + '[{0}m'.format(';'.join(str(attr) for attr in ansi)) + self.escape_hl_end
  
  	@staticmethod
  	def escape(string):
  		return string.replace('\\', '\\\\')
  
new_contents: # -*- coding: utf-8 -*-
  
  from powerline.renderer import Renderer
  from powerline.colorscheme import ATTR_BOLD, ATTR_ITALIC, ATTR_UNDERLINE
  
  
  class ShellRenderer(Renderer):
  	'''Powerline shell segment renderer.'''
  	escape_hl_start = ''
  	escape_hl_end = ''
  
  	def hlstyle(self, fg=None, bg=None, attr=None):
  		'''Highlight a segment.
  
  		If an argument is None, the argument is ignored. If an argument is
  		False, the argument is reset to the terminal defaults. If an argument
  		is a valid color or attribute, it's added to the ANSI escape code.
  		'''
  		ansi = []
  		if fg is not None:
  			if fg is False or fg[0] is False:
  				ansi += [39]
  			else:
  				if self.term_truecolor:
  					ansi += [38, 2] + list(self._int_to_rgb(fg[1]))
  				else:
  					ansi += [38, 5, fg[0]]
  		if bg is not None:
  			if bg is False or bg[0] is False:
  				ansi += [49]
  			else:
  				if self.term_truecolor:
  					ansi += [48, 2] + list(self._int_to_rgb(bg[1]))
  				else:
  					ansi += [48, 5, bg[0]]
  		if attr is not None:
  			if attr is False:
  				ansi += [22]
  			else:
  				if attr & ATTR_BOLD:
  					ansi += [1]
  				elif attr & ATTR_ITALIC:
  					# Note: is likely not to work or even be inverse in place of 
  					# italic. Omit using this in colorschemes.
  					ansi += [3]
  				elif attr & ATTR_UNDERLINE:
  					ansi += [4]
  		return self.escape_hl_start + '[{0}m'.format(';'.join(str(attr) for attr in ansi)) + self.escape_hl_end
  
  	@staticmethod
  	def escape(string):
  		return string.replace('\\', '\\\\')
  
subject: Add support for italic and underline attributes in shell renderer