fixing wrong attributes in some edgecases.
fixing edgecase resulting in wrong attributes
Merge remote-tracking branch 'c3ks/TermBuffer2' into TermBuffer2