mirror of
https://github.com/NuSkooler/enigma-bbs.git
synced 2025-08-03 00:12:01 +02:00
* Fix word wrap bug introduced prior -- use 'expand' not 'expandTabs'
* Notes on better access of views by ID * Work on apply process a bit * Replies can now be saved
This commit is contained in:
parent
a6d00b05a7
commit
b15d9a0bf8
7 changed files with 71 additions and 7 deletions
|
@ -12,6 +12,7 @@ function wordWrapText(text, options) {
|
|||
// width : word wrap width
|
||||
// tabHandling : expand (default=expand)
|
||||
// tabWidth : tab width if tabHandling is 'expand' (default=4)
|
||||
// tabChar : character to use for tab expansion
|
||||
//
|
||||
assert(_.isObject(options), 'Missing options!');
|
||||
assert(_.isNumber(options.width), 'Missing options.width!');
|
||||
|
@ -22,6 +23,8 @@ function wordWrapText(text, options) {
|
|||
options.tabWidth = 4;
|
||||
}
|
||||
|
||||
options.tabChar = options.tabChar || ' ';
|
||||
|
||||
//
|
||||
// Notes
|
||||
// * Sublime Text 3 for example considers spaces after a word
|
||||
|
@ -47,7 +50,7 @@ function wordWrapText(text, options) {
|
|||
|
||||
function expandTab(col) {
|
||||
var remainWidth = options.tabWidth - (col % options.tabWidth);
|
||||
return new Array(remainWidth).join('\t');
|
||||
return new Array(remainWidth).join(options.tabChar);
|
||||
}
|
||||
|
||||
// :TODO: support wrapping pipe code text (e.g. ignore color codes, expand MCI codes)
|
||||
|
@ -84,7 +87,7 @@ function wordWrapText(text, options) {
|
|||
// Nice info here: http://c-for-dummies.com/blog/?p=424
|
||||
//
|
||||
if('expand' === options.tabHandling) {
|
||||
word += expandTab(results.wrapped[i].length + word.length) + '\t';
|
||||
word += expandTab(results.wrapped[i].length + word.length) + options.tabChar;
|
||||
} else {
|
||||
word += m[0];
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue