Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 377238

Summary: global search and replace seems to have eaten my last line of code
Product: [ECD] Orion Reporter: Susan McCourt <susan>
Component: ClientAssignee: libing wang <libingw>
Status: RESOLVED FIXED QA Contact:
Severity: critical    
Priority: P3 CC: libingw
Version: 0.5   
Target Milestone: 0.5 M2   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Susan McCourt CLA 2012-04-19 23:09:19 EDT
I am in the middle of working on some experiments for bug 361546.
I decided to change dojo themes, and after working on a few pages with some success, I used global search to search for "nihilo"

I then used replace, preview, save to replace "nihilo" with "claro"

But what I'm seeing in git status is that every file with the replacements has also lost its last line.  So I'm losing the </html> in the html files, and the last import in the CSS files.

I did some other things in the course of working on this bug (such as a pull with uncommitted changes, etc.).  So it's possible I've done something else wrong but right now it looks like global replace might have a problem.  

I will follow up tomorrow with more detailed steps, just wanted to write this up in case it's something obvious that Libing could try.
Comment 1 libing wang CLA 2012-04-20 11:19:47 EDT
Seems critical, investigating in priority.
Comment 2 libing wang CLA 2012-04-20 11:26:39 EDT
(In reply to comment #0)
> I am in the middle of working on some experiments for bug 361546.
> I decided to change dojo themes, and after working on a few pages with some
> success, I used global search to search for "nihilo"
> I then used replace, preview, save to replace "nihilo" with "claro"
> But what I'm seeing in git status is that every file with the replacements has
> also lost its last line.  So I'm losing the </html> in the html files, and the
> last import in the CSS files.
> I did some other things in the course of working on this bug (such as a pull
> with uncommitted changes, etc.).  So it's possible I've done something else
> wrong but right now it looks like global replace might have a problem.  
> I will follow up tomorrow with more detailed steps, just wanted to write this
> up in case it's something obvious that Libing could try.

I could reproduce it, if you last line does not have line ending, very easy to reproduce. Will fix it soon.
Comment 3 libing wang CLA 2012-04-20 17:04:46 EDT
Good cathc, Susan.

Fixed with http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=1415d7226c56571198d60f08e97cdbccc7629ac3.

Sorry for the inconvenience. It must've wasted some of your time. But please do not be discouraged. 

The replace feature did not have this issue until recently I started to use splitFile function in utils.js.
That function was added by myself where my intention was to sync up the line numbers from editor if there are mixed line endings.

I should have but I did not use textModel directly.
Basically I am missing the last line when I used the new util API.

I changed the util API and the test cases so that the last line is restored but I think eventually I will use textModel for line endings in all compare, diff parsing, and replace eatures.
Will raise a new bug for that.
Comment 4 libing wang CLA 2012-04-20 17:13:39 EDT
Bug 377317 was raised to address using textModel for all text buffering.