Bug 558298

Summary: tab space [\t] not working in Tree item of Tree viewer
Product: [Eclipse Project] Platform Reporter: Keerthivasan Chinnathambi <Keerthivasan.Chinnathambi>
Component: SWTAssignee: Platform-SWT-Inbox <platform-swt-inbox>
Status: NEW --- QA Contact:
Severity: major    
Priority: P3 CC: Keerthivasan.Chinnathambi, paul-eclipse
Version: 4.8   
Target Milestone: ---   
Hardware: PC   
OS: Windows 10   
Whiteboard:
Attachments:
Description Flags
Shows the Problems view which displayed 'Hello\tWorld' message as 'HelloWorld' (without tabs) none

Description Keerthivasan Chinnathambi CLA 2019-12-13 06:30:03 EST
Created attachment 281230 [details]
Shows the Problems view which displayed 'Hello\tWorld' message as 'HelloWorld' (without tabs)

Tab space [\t] is not working in Tree item of a Tree viewer.

The best example is the treeviewer in the 'Problems' view.

Sample Label provider which returns 'Hello world' string with a tab space between both the strings: 

  @Override
  public String getText(final Object element) {
      return "Hello\tWorld";
  }

While returning text like above with tab space[\t] for Tree item label of a Tree viewer, it displays like "HelloWorld" without tab space in cell.

Attached screenshot(problems.png).

During the debug session, we found that the text is being set using the API org.eclipse.swt.widgets.TreeItem.setText(int, String) and I think, the data is being handed over to the OS for rendering. Till the text is set, '\t' appears in the text.


OS: Windows 10, version 1803 (OS Build 17134.1130)
Version: 2.2.200.v20180611-0500
Build id: I20180611-0500
There are no other plug-ins installed.

There are no additional
Comment 1 Paul Pazderski CLA 2019-12-13 08:48:35 EST
Also from the TableItem.setText Javadoc:

> * Note: If control characters like '\n', '\t' etc. are used
> * in the string, then the behavior is platform dependent.

The platform dependent behavior of native ListViews on Windows is to deny the existence of \r\n in table items and to my best knowledge it is the same for \t.