Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Make clicks in dead space in inline CSS widget set focus back to the act... #566

Merged
merged 1 commit into from
Apr 5, 2012

Conversation

njx
Copy link
Contributor

@njx njx commented Apr 5, 2012

...ual editor and set the selection to the beginning/end

Fixes #543 (and refactors my fix for #461).

…actual editor and set the selection to the beginning/end
endLine = this.lineCount() - 1;
}
var startLine = this.getFirstVisibleLine(),
endLine = this.getLastVisibleLine();
this.setSelection({line: startLine, ch: 0},
{line: endLine, ch: this.getLineText(endLine).length});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this isn't part of this pull request, but the setSelection() call here will not include the carriage return at the end of the last line. In other words, in an inline editor, if you do Cmd-A and Cmd-X, you will leave an extra blank line in the file. You can pass {line: endLine + 1, ch: 0} for the end pos to include the carriage return. (setSelection internally calls clipPos(), so this is safe even if endLine is the last line in the document).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a little tricky, because if the user then hits delete, there will be no visible lines left in the editor. We'd have to insert a new blank line in that case. I'm inclined to treat that as a separate bug (it's actually new behavior).

Sent from tiny phone

On Apr 5, 2012, at 7:30 AM, "Glenn Ruehle" reply@reply.github.com wrote:

@@ -357,14 +357,8 @@ define(function (require, exports, module) {
* bugs in CodeMirror when lines are hidden.
*/
Editor.prototype._selectAllVisible = function () {

  •    var startLine, endLine;
    
  •    if (this._visibleRange) {
    
  •        startLine = this._visibleRange.startLine;
    
  •        endLine = this._visibleRange.endLine;
    
  •    } else {
    
  •        startLine = 0;
    
  •        endLine = this.lineCount() - 1;
    
  •    }
    
  •    var startLine = this.getFirstVisibleLine(),
    
  •        endLine = this.getLastVisibleLine();
    this.setSelection({line: startLine, ch: 0},
                      {line: endLine, ch: this.getLineText(endLine).length});
    

I know this isn't part of this pull request, but the setSelection() call here will not include the carriage return at the end of the last line. In other words, in an inline editor, if you do Cmd-A and Cmd-X, you will leave an extra blank line in the file. You can pass {line: endLine + 1, ch: 0} for the end pos to include the carriage return. (setSelection internally calls clipPos(), so this is safe even if endLine is the last line in the document).


Reply to this email directly or view it on GitHub:
https://github.com/adobe/brackets/pull/566/files#r650333

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good.

@gruehle
Copy link
Member

gruehle commented Apr 5, 2012

Initial review complete.

gruehle added a commit that referenced this pull request Apr 5, 2012
Make clicks in dead space in inline CSS widget set focus back to the act...
@gruehle gruehle merged commit a83551a into master Apr 5, 2012
gideonthomas added a commit to gideonthomas/brackets that referenced this pull request Feb 10, 2017
…ame before creating a new file (adobe#566)

* Fix mozilla/thimble.mozilla.org#1564 - Check for existing file with name before creating a new file

* Review Fix: Parentheses around ++ operator
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Clicking in the blank area below the very last line of code won't set IP at the end of code in inline editor.
2 participants