Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(717)

Unified Diff: ui/file_manager/file_manager/foreground/js/file_manager.js

Issue 279753002: Focus whole entry name when renaming directories. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/file_manager/file_manager/foreground/js/file_manager.js
diff --git a/ui/file_manager/file_manager/foreground/js/file_manager.js b/ui/file_manager/file_manager/foreground/js/file_manager.js
index 07aa224b3ebc1948916ff8d7abd28065e95b46f3..b51d7dea884e74e19c79408cd58cf2a4aaf8c345 100644
--- a/ui/file_manager/file_manager/foreground/js/file_manager.js
+++ b/ui/file_manager/file_manager/foreground/js/file_manager.js
@@ -2435,22 +2435,24 @@ var BOTTOM_MARGIN_FOR_PREVIEW_PANEL_PX = 52;
return;
var label = item.querySelector('.filename-label');
var input = this.renameInput_;
+ var currentEntry = this.currentList_.dataModel.item(item.listIndex);
input.value = label.textContent;
item.setAttribute('renaming', '');
label.parentNode.appendChild(input);
input.focus();
+
var selectionEnd = input.value.lastIndexOf('.');
- if (selectionEnd == -1) {
- input.select();
- } else {
+ if (currentEntry.isFile && selectionEnd !== -1) {
input.selectionStart = 0;
input.selectionEnd = selectionEnd;
+ } else {
+ input.select();
}
// This has to be set late in the process so we don't handle spurious
// blur events.
- input.currentEntry = this.currentList_.dataModel.item(item.listIndex);
+ input.currentEntry = currentEntry;
this.table_.startBatchUpdates();
this.grid_.startBatchUpdates();
};
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698