Closed Bug 499289 Opened 15 years ago Closed 15 years ago

Hitting enter does not replace selected (line of) text

Categories

(Skywriter Graveyard :: Editor, defect)

0.2.3
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: Lukas.jungmann, Unassigned)

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.11) Gecko/2009060215 Firefox/3.0.11 (.NET CLR 3.5.30729)
Build Identifier: 0.2.3

one way to delete whole line of text in most editors is to select the line using Shift+<UP> or Shift+<DOWN> and then hit enter to replace selection by one empty line. This way in bespin does not work, instead it adds new empty line after the selection.

Note that if I use any other key than Enter then selection is being correctly replaced

Reproducible: Always

Steps to Reproduce:
1. open https://bespin.mozilla.com/dashboard.html in Safari4 on Vista
2. edit some js file, ie. example.js in a sample project
3. select some line and hit Enter to replace selected line with empty line

Actual Results:  
new empty line is added

Expected Results:  
selected line is replaced by empty line (as it is in desktop editor, ie PSPad)
whoops, copy & paste error - this is reproducible in FF3.0.11 on vista (not sure about safari4 as stated in steps to reproduce), sorry
Confirming, as this is still present in tip. I'm pretty sure this isn't browser-specific, but for the record, I'm using Firefox 3.5.
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Windows Vista → All
Hardware: x86 → All
Version: unspecified → 0.2.3
I have fixed this here:
http://bitbucket.org/alexi/bespin-fixes/changeset/ad34e8438530/

Why have newline call splitRow with an undo action of joinLine? This requires more actions like deleteSelectionAndInsertNewLine, joinLineAndInsertChunkAndSelect, etc., which seems redundant as we already have deleteSelectionAndInsertChunk, etc. So I changed it to make splitRow proxy for insertChunk, adding just a bit of logic to calculate autoindent.
I didn't noticed, that Alex already had a patch for this problem. So I worked on it by myself. The patch is here:

http://bitbucket.org/j4c/bespin/changeset/de05d7d02a14/

I had to do some other changes to get this working. So, if Alex patch works, this would be the easier solution.

Julian
I've replaced my solution with the one of Alex. Also, I improved some other things. You can pull it from here:

http://bitbucket.org/j4c/bespin/
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.