Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 338254 - [misc] Tab key does not work in JSP Scriptlet when using insert spaces for tabs mode
Summary: [misc] Tab key does not work in JSP Scriptlet when using insert spaces for ta...
Status: ASSIGNED
Alias: None
Product: WTP Source Editing
Classification: WebTools
Component: jst.jsp (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.6.2   Edit
Assignee: Salvador Zalapa CLA
QA Contact: Nick Sandonato CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-25 13:20 EST by Jeff B CLA
Modified: 2014-09-18 13:58 EDT (History)
2 users (show)

See Also:
zalapa: review? (nsand.dev)


Attachments
patch (2.97 KB, patch)
2013-07-24 13:30 EDT, Salvador Zalapa CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jeff B CLA 2011-02-25 13:20:16 EST
Build Identifier: 20100917-0705

In preferences, if I check
General/Editors/Text Editors -> Insert spaces for tabs
the tab key has no effect in the JSP editor in a JSP Scriptlet (i.e. I hit it an the line isn't indented). If I uncheck Insert spaces for tabs, the tab key works in the JSP editor.

The tab key appears to work correctly outside of the context of a scriptlet.

Reproducible: Always

Steps to Reproduce:
1. In preferences, check General/Editors/Text Editors -> Insert spaces for tabs
2. open a JSP file in the JSP editor, and edit a JSP Scriptlet (<% %>)
3. When the cursor is at the beginning of a line, try to indent a line in the scriptlet using the tab key.  Nothing will happen.

Also,
4. If you place the cursor before the first non-whitespace character on a line that was already indented with tabs, and press the tab key, the indentation will be removed.

Note: the file I am trying to edit was originally indented with tabs.
Comment 1 Nick Sandonato CLA 2011-10-11 18:24:37 EDT
This looks like a result of the JavaAutoIndentStrategy running on the indent. It collapses it to "correct" indent for what should be at that line. For example, if you have
if (true) {
[]
}
and a tab is inserted at [], the correct indentation will occur.
Comment 2 Nick Sandonato CLA 2011-10-11 18:25:17 EDT
I should add, this runs in TextViewer#customizeDocumentCommand
Comment 3 Salvador Zalapa CLA 2013-03-21 17:44:36 EDT
Indeed this is caused do to JavaAutoIndentStrategy, when the text length   of the command is higher than 1 (in this scenario the length is 4) it performs the a smartPaste, cutting the indent proposed. In order to confirm the statement, uncheck the "Adjust indentation" (Java>Editor>Typing) and notice that now it works correctly. Still investigating ..
Comment 4 Salvador Zalapa CLA 2013-03-22 18:44:12 EDT
i just created 

https://bugs.eclipse.org/bugs/show_bug.cgi?id=404190

to reported the new issue.
Comment 5 Salvador Zalapa CLA 2013-03-22 18:46:36 EDT
My mistake, sorry Please ignore the previous comment.
Comment 6 Salvador Zalapa CLA 2013-05-14 13:05:32 EDT
Adding a proposed patch, that marks the command to not be handled by avaAutoIndentStrategy, i already test that the behavior remains untouched.

https://github.com/zalapa/webtools.sourceediting/commit/c9063af64eb154730cd58235d1e340ec6a20f33f
Comment 7 Salvador Zalapa CLA 2013-07-24 13:30:14 EDT
Created attachment 233764 [details]
patch

Nick, improving patch with your suggestions.
Comment 8 Salvador Zalapa CLA 2013-07-24 13:30:40 EDT
Yes, I am in compliance with the Certificate of Origin