function(text, start, end) {
			var range = require('range').create(start, end);
			
			var reSpace = /[\s\n\r\u00a0]/;
			// narrow down selection until first non-space character
			while (range.start < range.end) {
				if (!reSpace.test(text.charAt(range.start)))
					break;
					
				range.start++;
			}
			
			while (range.end > range.start) {
				range.end--;
				if (!reSpace.test(text.charAt(range.end))) {
					range.end++;
					break;
				}
			}
			
			return range;
		}
function(text, start, end) {
			var range = require('range').create(start, end);
			
			var reSpace = /[\s\n\r\u00a0]/;
			
			while (range.start < range.end) {
				if (!reSpace.test(text.charAt(range.start)))
					break;
					
				range.start++;
			}
			
			while (range.end > range.start) {
				range.end--;
				if (!reSpace.test(text.charAt(range.end))) {
					range.end++;
					break;
				}
			}
			
			return range;
		}
function ( text , start , end ) { var range = require ( 'range' ) . create ( start , end ) ; var reSpace = / [\s\n\r\u00a0] / ; // narrow down selection until first non-space character while ( range . start < range . end ) { if ( ! reSpace . test ( text . charAt ( range . start ) ) ) break ; range . start ++ ; } while ( range . end > range . start ) { range . end -- ; if ( ! reSpace . test ( text . charAt ( range . end ) ) ) { range . end ++ ; break ; } } return range ; }
Narrows down text range, adjusting selection to non-space characters
@param {String} text
@param {Number} start Starting range in <code>text</code> where
slection should be adjusted. Can also be any object that is accepted
by <code>Range</code> class
@return {Range}
Narrows down text range adjusting selection to non - space characters