-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Make clicks in dead space in inline CSS widget set focus back to the act... #566
Conversation
…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}); |
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good.
Initial review complete. |
Make clicks in dead space in inline CSS widget set focus back to the act...
…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
...ual editor and set the selection to the beginning/end
Fixes #543 (and refactors my fix for #461).