Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 247761 - Single carriage return character (x0D) is misplaced instead of line feed (x0A) when I type "do" keyword at end of line
Summary: Single carriage return character (x0D) is misplaced instead of line feed (x0A...
Status: VERIFIED FIXED
Alias: None
Product: DLTK
Classification: Technology
Component: Ruby (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: 1.0M3   Edit
Assignee: dltk.ruby-inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-09-17 19:50 EDT by Atsushi Hasegawa CLA
Modified: 2010-06-11 06:30 EDT (History)
1 user (show)

See Also:


Attachments
Single carriage return character (x0D) is misplaced as new line in do block (13.86 KB, image/png)
2008-09-17 19:56 EDT, Atsushi Hasegawa CLA
alex.panchenko: iplog-
Details
Patch to place getDefaultLineDelimiter() string (1.20 KB, patch)
2008-09-18 13:34 EDT, Atsushi Hasegawa CLA
alex.panchenko: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Atsushi Hasegawa CLA 2008-09-17 19:50:48 EDT
Steps:
1. Create a Ruby Class
File | New | Ruby Class
< File: [Case7053] > 
< Finish >

2. Paste the following snippet on the Case7053.rb file.
File | Save

3. Type do block from the end of line 4
  Place a caret position at end of line 4 (Line: 4, Column: 19)
  [Enter][list.each][Space][do][Enter] // Type [Enter] key at first and type "list.each do" to start do block, then type [Enter] key again.

// exp: The end of line 6 should be terminated by line feed (x0A) which is new line character for ruby.
// act: The end of line 6 is terminated by single carriage return (x0D) which is
considered as white space in ruby. So, the script would have syntax error when I
comment out line 6.

# Test snippet 7053 for do block
class Case7053
  def initialize
    list = [1,2,3]
#    list.each do
#      puts "A"
#    end
  end
end
Case7053.new
# End of snippet 7053
Comment 1 Atsushi Hasegawa CLA 2008-09-17 19:56:33 EDT
Created attachment 112846 [details]
Single carriage return character (x0D) is misplaced as new line in do block
Comment 2 Atsushi Hasegawa CLA 2008-09-18 13:34:23 EDT
Created attachment 112929 [details]
Patch to place getDefaultLineDelimiter() string
Comment 3 Alex Panchenko CLA 2008-09-18 21:48:34 EDT
Now the matching "end" keyword is added in RubyBracketInserter and in RubyAutoEditStrategy classes, so we have duplicate functionality for the same task.
We should leave only brackets and quotes in RubyBracketInserter and implement everything else as AutoEditStrategy.
Additional linked-mode logic in RubyBracketInserter does not work as designed with multi-line constructs anyway.
Comment 4 Alex Panchenko CLA 2008-09-30 07:31:57 EDT
I have applied the patch but the code needs refactoring.
Comment 5 Alex Panchenko CLA 2008-11-01 07:55:23 EDT
I have move smart insert of the "end" keyword after space character from RubyBracketInserter to RubyAutoEditStrategy, so this issue could be closed.
Comment 6 Atsushi Hasegawa CLA 2008-11-13 18:46:55 EST
Verified in HEAD.
Thanks,