summaryrefslogtreecommitdiffstats
path: root/data/js/util.js
diff options
context:
space:
mode:
Diffstat (limited to 'data/js/util.js')
-rw-r--r--data/js/util.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/data/js/util.js b/data/js/util.js
index 6c88edb2d..af3635673 100644
--- a/data/js/util.js
+++ b/data/js/util.js
@@ -43,6 +43,16 @@ define(['jquery'], function () {
},
setTabwidthFromLocalStorage: function () {
this.setTabwidth(localStorage.getItem('tabwidth'));
+ },
+ setLineWrap: function (lines_wrapped) {
+ var whitespaceMode = lines_wrapped ? 'pre-wrap' : 'pre';
+ $('.highlight > pre').css('white-space', whitespaceMode);
+ localStorage.setItem('lines_wrapped', lines_wrapped);
+ },
+ toggleLineWrap: function() {
+ this.setLineWrap(
+ localStorage.getItem('lines_wrapped') !== 'true'
+ );
}
};
return Util;