@@ -73,7 +73,8 @@ define(function (require, exports, module) {
7373 ViewUtils = require ( "utils/ViewUtils" ) ;
7474
7575 var PREFERENCES_CLIENT_ID = "com.adobe.brackets.Editor" ,
76- defaultPrefs = { useTabChar : false , tabSize : 4 , indentUnit : 4 , closeBrackets : false } ;
76+ defaultPrefs = { useTabChar : false , tabSize : 4 , indentUnit : 4 , closeBrackets : false ,
77+ showLineNumbers : true , styleActiveLine : true , wordWrap : true } ;
7778
7879 /** Editor preferences */
7980 var _prefs = PreferencesManager . getPreferenceStorage ( PREFERENCES_CLIENT_ID , defaultPrefs ) ;
@@ -90,6 +91,15 @@ define(function (require, exports, module) {
9091 /** @type {boolean } Global setting: Auto closes (, {, [, " and ' */
9192 var _closeBrackets = _prefs . getValue ( "closeBrackets" ) ;
9293
94+ /** @type {boolean } Global setting: Show line numbers in the gutter */
95+ var _showLineNumbers = _prefs . getValue ( "showLineNumbers" ) ;
96+
97+ /** @type {boolean } Global setting: Highlight the background of the line that has the cursor */
98+ var _styleActiveLine = _prefs . getValue ( "styleActiveLine" ) ;
99+
100+ /** @type {boolean } Global setting: Auto wrap lines */
101+ var _wordWrap = _prefs . getValue ( "wordWrap" ) ;
102+
93103 /** @type {boolean } Guard flag to prevent focus() reentrancy (via blur handlers), even across Editors */
94104 var _duringFocus = false ;
95105
@@ -344,9 +354,11 @@ define(function (require, exports, module) {
344354 indentWithTabs : _useTabChar ,
345355 tabSize : _tabSize ,
346356 indentUnit : _indentUnit ,
347- lineNumbers : true ,
357+ lineNumbers : _showLineNumbers ,
358+ lineWrapping : _wordWrap ,
359+ styleActiveLine : _styleActiveLine ,
348360 matchBrackets : true ,
349- dragDrop : false , // work around issue #1123
361+ dragDrop : true ,
350362 extraKeys : codeMirrorKeyMap ,
351363 autoCloseBrackets : _closeBrackets ,
352364 autoCloseTags : {
@@ -1363,6 +1375,60 @@ define(function (require, exports, module) {
13631375 return _closeBrackets ;
13641376 } ;
13651377
1378+ /**
1379+ * Sets show line numbers option and reapply it to all open editors.
1380+ * @param {boolean } value
1381+ */
1382+ Editor . setShowLineNumbers = function ( value ) {
1383+ _showLineNumbers = value ;
1384+ _instances . forEach ( function ( editor ) {
1385+ editor . _codeMirror . setOption ( "lineNumbers" , _showLineNumbers ) ;
1386+ } ) ;
1387+
1388+ _prefs . setValue ( "showLineNumbers" , Boolean ( _showLineNumbers ) ) ;
1389+ } ;
1390+
1391+ /** @type {boolean } Gets whether all editors are showing line numbers */
1392+ Editor . getShowLineNumbers = function ( ) {
1393+ return _showLineNumbers ;
1394+ } ;
1395+
1396+ /**
1397+ * Sets show active line option and reapply it to all open editors.
1398+ * @param {boolean } value
1399+ */
1400+ Editor . setShowActiveLine = function ( value ) {
1401+ _styleActiveLine = value ;
1402+ _instances . forEach ( function ( editor ) {
1403+ editor . _codeMirror . setOption ( "styleActiveLine" , _styleActiveLine ) ;
1404+ } ) ;
1405+
1406+ _prefs . setValue ( "styleActiveLine" , Boolean ( _styleActiveLine ) ) ;
1407+ } ;
1408+
1409+ /** @type {boolean } Gets whether all editors are showing active line */
1410+ Editor . getShowActiveLine = function ( ) {
1411+ return _styleActiveLine ;
1412+ } ;
1413+
1414+ /**
1415+ * Sets word wrap option and reapply it to all open editors.
1416+ * @param {boolean } value
1417+ */
1418+ Editor . setWordWrap = function ( value ) {
1419+ _wordWrap = value ;
1420+ _instances . forEach ( function ( editor ) {
1421+ editor . _codeMirror . setOption ( "lineWrapping" , _wordWrap ) ;
1422+ } ) ;
1423+
1424+ _prefs . setValue ( "wordWrap" , Boolean ( _wordWrap ) ) ;
1425+ } ;
1426+
1427+ /** @type {boolean } Gets whether all editors are enabled for word wrap */
1428+ Editor . getWordWrap = function ( ) {
1429+ return _wordWrap ;
1430+ } ;
1431+
13661432 // Define public API
13671433 exports . Editor = Editor ;
13681434 exports . BOUNDARY_CHECK_NORMAL = BOUNDARY_CHECK_NORMAL ;
0 commit comments