Bug 558298 - tab space [\t] not working in Tree item of Tree viewer
Summary: tab space [\t] not working in Tree item of Tree viewer
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.8   Edit
Hardware: PC Windows 10
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-12-13 06:30 EST by Keerthivasan Chinnathambi CLA
Modified: 2019-12-13 08:48 EST (History)
2 users (show)

See Also:


Attachments
Shows the Problems view which displayed 'Hello\tWorld' message as 'HelloWorld' (without tabs) (28.76 KB, image/png)
2019-12-13 06:30 EST, Keerthivasan Chinnathambi CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
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.