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.5k
Allow code-folding for selected text in editor #11538
Merged
Merged
Changes from 3 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
75b3ace
Added feature to enable code folding for arbitrary selections in the …
thehogfather 798c8d0
Basic unit tests for code-folding extension
thehogfather 210f0ba
Merge branch 'master' of https://github.com/adobe/brackets into code-…
thehogfather 411ee7c
Merge branch 'master' of https://github.com/adobe/brackets into fold-…
thehogfather 3523389
added test cases including enabling and disabling extension, and chec…
thehogfather 574279a
Merge branch 'master' of https://github.com/adobe/brackets into code-…
thehogfather f601475
Merge commit '1e09fb219224cd80137a8bd1f0cb8326c6814010' into fold-sel…
thehogfather 1eba0ae
Added nls Strings description for code-folding feature for making sel…
thehogfather ab8039f
added test for clearing correctness of clearing fold marks in editor
thehogfather 25ae796
updated logic for restoring line folds to account for selection folds
thehogfather 2e0adde
Merge branch 'master' of https://github.com/adobe/brackets into fold-…
thehogfather 8e9dbee
Merge branch 'master' of https://github.com/adobe/brackets into code-…
thehogfather 853b5d1
fix for the creation of multiple fold range widgets for a single coll…
thehogfather 0f9ffba
Merge branch 'fold-selected' into code-folding-unit-tests
thehogfather eb419aa
documented and refactored restoreLineFolds function
thehogfather dd3be9f
documented and refactored restoreLineFolds function
thehogfather 632bff4
Merge branch 'code-folding-unit-tests' into fold-selected
thehogfather 0545f9d
fixed refresh rendering bug with selection based fold
thehogfather f1e4472
Revert "documented and refactored restoreLineFolds function"
thehogfather 3603849
removed unit test files
thehogfather 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
30 changes: 30 additions & 0 deletions
30
src/extensions/default/CodeFolding/foldhelpers/foldSelected.js
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 |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| /** | ||
| * Selection range helper for code folding. | ||
| * @author Patrick Oladimeji | ||
| * @date 31/07/2015 00:11:53 | ||
| */ | ||
| /*global define*/ | ||
| define(function (require, exports, module) { | ||
| "use strict"; | ||
|
|
||
| /** | ||
| * This helper returns the start and end range represeting the current selection in the editor. | ||
| * @param {Object} cm The Codemirror instance | ||
| * @param {Object} start A Codemirror.Pos object {line, ch} representing the current line we are | ||
| * checking for fold ranges | ||
| * @returns {Object} The fold range, {from, to} representing the current selection. | ||
| */ | ||
| function SelectionFold(cm, start) { | ||
| if (!cm.somethingSelected()) { | ||
| return; | ||
| } | ||
|
|
||
| var from = cm.getCursor("from"), | ||
| to = cm.getCursor("to"); | ||
| if (from.line === start.line) { | ||
| return {from: from, to: to}; | ||
| } | ||
| } | ||
|
|
||
| module.exports = SelectionFold; | ||
| }); |
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.
Use
Strings.*instead for thedescriptionso it's translateable.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.
@marcelgerber sure thing! I shall update.