diff options
| author | Stephen Blott | 2016-10-23 15:50:46 +0100 | 
|---|---|---|
| committer | Stephen Blott | 2016-10-23 15:50:46 +0100 | 
| commit | decf9a145d4a1f7107fe0ce533765891960f5555 (patch) | |
| tree | d06ddec356cbde9c8fa8ca304c14efcb796cb309 /background_scripts/bg_utils.coffee | |
| parent | bc2f5e0f52179e915ed7a439fc6bfa03525156ee (diff) | |
| download | vimium-decf9a145d4a1f7107fe0ce533765891960f5555.tar.bz2 | |
Better line parsing (simplified).
Diffstat (limited to 'background_scripts/bg_utils.coffee')
| -rw-r--r-- | background_scripts/bg_utils.coffee | 14 | 
1 files changed, 4 insertions, 10 deletions
| diff --git a/background_scripts/bg_utils.coffee b/background_scripts/bg_utils.coffee index 27ecb0cc..26033476 100644 --- a/background_scripts/bg_utils.coffee +++ b/background_scripts/bg_utils.coffee @@ -77,18 +77,12 @@ BgUtils =              logElement.value += "#{dateString}: #{message}\n"              logElement.scrollTop = 2000000000 -  # Remove comments from a list of lines and merge lines where the last character on the preceding line is "\". -  parseLines: (lines) -> -    previousText = [] -    for line in lines -      line = line.replace /^\s+/g, '' +  # Remove comments and leading/trailing whitespace from a list of lines, and merge lines where the last +  # character on the preceding line is "\". +  parseLines: (text) -> +    for line in text.replace(/\\\n/g, "").split("\n").map((line) -> line.trim())        continue if line.length == 0        continue if line[0] in '#"' -      if line[line.length-1] == "\\" -        previousText.push line[...line.length-1] -        continue -      line = previousText.join(" ") + line -      previousText = []        line  root.BgUtils = BgUtils | 
