def fix_dashes(view, edit, text_region, dash_region):
 if (len(view.substr(text_region).strip()) == 0):
  return
 old_dashes = view.substr(dash_region)
 first_dash = old_dashes[0]
 new_dashes = (first_dash * text_region.size())
 view.replace(edit, dash_region, new_dashes)

def fix_dashes ( view , edit , text_region , dash_region ) : if ( len ( view . substr ( text_region ) . strip ( ) ) == 0 ) : return old_dashes = view . substr ( dash_region ) first_dash = old_dashes [ 0 ] new_dashes = ( first_dash * text_region . size ( ) ) view . replace ( edit , dash_region , new_dashes )
replaces the underlined "dash" region of a setext header with a run of dashes or equal-signs that match the length of the header text .