Closed
Bug 725382
Opened 14 years ago
Closed 13 years ago
Add feature to sourceeditor/scratchpad: delete line(s)
Categories
(DevTools :: Source Editor, defect, P5)
DevTools
Source Editor
Tracking
(Not tracked)
RESOLVED
WONTFIX
People
(Reporter: johan.charlez, Assigned: lcamacho)
Details
(Whiteboard: [sourceeditor][good first bug][mentor=msucan][lang=js])
Attachments
(1 file, 1 obsolete file)
|
1.98 KB,
patch
|
msucan
:
feedback+
|
Details | Diff | Splinter Review |
A quick way (menuitem + keyboard shortcut?) of deleting one or several lines without having to select every bit of text on said lines could be another great addition to the sourceeditor/scratchpad.
Use case 1:
1) Place caret cursor/marker on a line
2) Use "Delete Current Line" or the the keyboard shortcut.
3) The current line is deleted, leaving no empty line.
Use case 2:
1) Select some text on several lines.
2) Use "Delete Current Lines" or the the keyboard shortcut.
3) All lines on which some text is selected are deleted.
Whiteboard: § → [sourceeditor][good first bug][mentor=msucan][lang=js]
Updated•14 years ago
|
Assignee: nobody → leonard.camacho
Status: NEW → ASSIGNED
| Assignee | ||
Comment 1•14 years ago
|
||
Attachment #597666 -
Flags: feedback?(mihai.sucan)
Comment 2•14 years ago
|
||
Comment on attachment 597666 [details] [diff] [review]
Delete lines
Review of attachment 597666 [details] [diff] [review]:
-----------------------------------------------------------------
Great work Leonard! Thanks a lot for your contributions!
One bug: when I select an entire line, the code is confused and it thinks I selected the second line as well.
::: browser/devtools/sourceeditor/source-editor-orion.jsm
@@ +654,5 @@
> },
>
> /**
> + * Delete the lines or line that have some text selected,
> + * if there's no selection delete the actual line.
Please add @private to mark the method as private.
@@ +656,5 @@
> /**
> + * Delete the lines or line that have some text selected,
> + * if there's no selection delete the actual line.
> + */
> + _deleteLines: function SE_deleteLines()
SE__deleteLines()
@@ +662,5 @@
> + let selection = this.getSelection();
> + let firstLine = this._model.getLineAtOffset(selection.start);
> + let firstLineStart = this._model.getLineStart(firstLine);
> + let lastLine = this._model.getLineAtOffset(selection.end);
> + let lastLineEnd = this._model.getLineEnd(lastLine);
You need to include the line end: getLineEnd(lastLine, true). Currently Ctrl-D leaves an empty line.
@@ +664,5 @@
> + let firstLineStart = this._model.getLineStart(firstLine);
> + let lastLine = this._model.getLineAtOffset(selection.end);
> + let lastLineEnd = this._model.getLineEnd(lastLine);
> +
> + this.setText('', firstLineStart, lastLineEnd);
Please use double quotes.
At the end of the function please return true. This is needed for the Orion API: actions that execute successfully need to return true.
Attachment #597666 -
Flags: feedback?(mihai.sucan) → feedback+
| Assignee | ||
Comment 3•14 years ago
|
||
Attachment #597666 -
Attachment is obsolete: true
Attachment #598546 -
Flags: feedback?(mihai.sucan)
Comment 4•14 years ago
|
||
Comment on attachment 598546 [details] [diff] [review]
Delete lines V2
Review of attachment 598546 [details] [diff] [review]:
-----------------------------------------------------------------
Thanks for the patch update! This is working well. Please go ahead and write the test!
Looking forward to see the test!
::: browser/devtools/sourceeditor/source-editor-orion.jsm
@@ +667,5 @@
> + let firstLine = this._model.getLineAtOffset(selection.start);
> + let firstLineStart = this._model.getLineStart(firstLine);
> + let lastLine = this._model.getLineAtOffset(selection.end);
> + let lastLineEnd = this._model.getLineEnd(lastLine, true);
> + let lastLineStart = this._model.getLineStart(lastLine);
nit: lastLineStart then lastLineEnd.
@@ +670,5 @@
> + let lastLineEnd = this._model.getLineEnd(lastLine, true);
> + let lastLineStart = this._model.getLineStart(lastLine);
> +
> + if (selection.start != selection.end && lastLineStart == selection.end) {
> + lastLine -= 1;
You can put this check immediately after you get lastLine.
Attachment #598546 -
Flags: feedback?(mihai.sucan) → feedback+
Comment 5•13 years ago
|
||
Moving to Source Editor component.
Filter on CHELICERAE.
Component: Developer Tools → Developer Tools: Source Editor
Updated•13 years ago
|
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Priority: -- → P5
Resolution: --- → WONTFIX
Updated•7 years ago
|
Product: Firefox → DevTools
You need to log in
before you can comment on or make changes to this bug.
Description
•