This repository was archived by the owner on Sep 6, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Add Status bar Indicator for Overwrite mode #6670
Closed
WebsiteDeveloper
wants to merge
7
commits into
adobe:master
from
WebsiteDeveloper:AddOverwriteStatusIndicator
Closed
Changes from 5 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
6c0be88
Add Status bar Indicator
WebsiteDeveloper 2b074bd
Adjust to CodeMirror commit
WebsiteDeveloper 3578b2d
Add proposed changes
WebsiteDeveloper a0dcdd6
Add fading out
WebsiteDeveloper 1c4f926
Add localisation
WebsiteDeveloper 2b49273
changes after review
WebsiteDeveloper 4dc553d
Minor improvement
WebsiteDeveloper File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,7 +46,8 @@ define(function (require, exports, module) { | |
$fileInfo, | ||
$indentType, | ||
$indentWidthLabel, | ||
$indentWidthInput; | ||
$indentWidthInput, | ||
$statusOverwrite; | ||
|
||
|
||
function _formatCountable(number, singularStr, pluralStr) { | ||
|
@@ -141,6 +142,25 @@ define(function (require, exports, module) { | |
_updateCursorInfo(); | ||
} | ||
|
||
function _updateOverwriteLabel(event, editor, newstate) { | ||
if (!newstate) { | ||
$statusOverwrite.addClass("active"); | ||
$statusOverwrite.text(Strings.STATUSBAR_INSERT); | ||
} else { | ||
$statusOverwrite.addClass("active"); | ||
$statusOverwrite.text(Strings.STATUSBAR_OVERWRITE); | ||
} | ||
window.setTimeout(function () { | ||
$statusOverwrite.removeClass("active"); | ||
}, 1000); | ||
} | ||
|
||
function _updateEditorOverwriteMode() { | ||
var editor = EditorManager.getActiveEditor(); | ||
|
||
editor._codeMirror.toggleOverwrite(null); | ||
} | ||
|
||
function _onActiveEditorChange(event, current, previous) { | ||
if (previous) { | ||
$(previous).off(".statusbar"); | ||
|
@@ -151,6 +171,7 @@ define(function (require, exports, module) { | |
if (!current) { | ||
StatusBar.hide(); // calls resizeEditor() if needed | ||
} else { | ||
current._codeMirror.toggleOverwrite($statusOverwrite.hasClass("active")); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This can't be used any more. |
||
StatusBar.show(); // calls resizeEditor() if needed | ||
|
||
$(current).on("cursorActivity.statusbar", _updateCursorInfo); | ||
|
@@ -162,6 +183,7 @@ define(function (require, exports, module) { | |
// async update to keep typing speed smooth | ||
window.setTimeout(function () { _updateFileInfo(current); }, 0); | ||
}); | ||
$(current).on("overwriteToggle.statusbar", _updateOverwriteLabel); | ||
|
||
current.document.addRef(); | ||
$(current.document).on("languageChanged.statusbar", function () { _updateLanguageInfo(current); }); | ||
|
@@ -181,6 +203,7 @@ define(function (require, exports, module) { | |
$indentType = $("#indent-type"); | ||
$indentWidthLabel = $("#indent-width-label"); | ||
$indentWidthInput = $("#indent-width-input"); | ||
$statusOverwrite = $("#status-overwrite"); | ||
|
||
// indentation event handlers | ||
$indentType.on("click", _toggleIndentType); | ||
|
@@ -208,6 +231,8 @@ define(function (require, exports, module) { | |
|
||
$indentWidthInput.focus(function () { $indentWidthInput.select(); }); | ||
|
||
$statusOverwrite.on("click", _updateEditorOverwriteMode); | ||
|
||
_onActiveEditorChange(null, EditorManager.getActiveEditor(), null); | ||
} | ||
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Should we make a new
Editor.toggleOverwrite
method which just doesthis._codeMirror.toggleOverwrite(value)
, so that we don't access the private member_codeMirror
?