Commit dbd633b6 authored by RawKStar77's avatar RawKStar77

Break up long lines of code over multiple lines

parent f4ceb8d0
...@@ -53,7 +53,10 @@ markdown = ['$filter', '$timeout', ($filter, $timeout) -> ...@@ -53,7 +53,10 @@ markdown = ['$filter', '$timeout', ($filter, $timeout) ->
slice2 = text.after.slice(0, markup.length) slice2 = text.after.slice(0, markup.length)
if slice1 == markup and slice2 == markup if slice1 == markup and slice2 == markup
# Remove markup # Remove markup
newtext = text.before.slice(0, (text.before.length - markup.length)) + text.selection + text.after.slice(markup.length) newtext = (
text.before.slice(0, (text.before.length - markup.length)) +
text.selection + text.after.slice(markup.length)
)
start = text.before.length - markup.length start = text.before.length - markup.length
end = (text.before + text.selection).length - markup.length end = (text.before + text.selection).length - markup.length
insertMarkup(newtext, start, end) insertMarkup(newtext, start, end)
...@@ -148,7 +151,10 @@ markdown = ['$filter', '$timeout', ($filter, $timeout) -> ...@@ -148,7 +151,10 @@ markdown = ['$filter', '$timeout', ($filter, $timeout) ->
# The partial selection happens to fall on the firstline # The partial selection happens to fall on the firstline
newstring = markup + newstring newstring = markup + newstring
else else
newstring = newstring.substring(0, (indexoflastnewline + 1)) + markup + newstring.substring(indexoflastnewline + 1) newstring = (
newstring.substring(0, (indexoflastnewline + 1)) +
markup + newstring.substring(indexoflastnewline + 1)
)
value = newstring + text.after value = newstring + text.after
start = (text.before + markup).length start = (text.before + markup).length
end = (text.before + text.selection + markup).length end = (text.before + text.selection + markup).length
...@@ -167,10 +173,13 @@ markdown = ['$filter', '$timeout', ($filter, $timeout) -> ...@@ -167,10 +173,13 @@ markdown = ['$filter', '$timeout', ($filter, $timeout) ->
end = (text.before + markup).length end = (text.before + markup).length
insertMarkup(value, start, end) insertMarkup(value, start, end)
else else
# No selection, cursor is not on new line. Go to the previous newline and insert markup there. # No selection, cursor is not on new line.
# # Check to see if markup has already been inserted. # Check to see if markup has already been inserted.
if text.before.slice(text.before.length - markup.length) == markup if text.before.slice(text.before.length - markup.length) == markup
newtext = text.before.substring(0, (index)) + "\n" + text.before.substring(index + 1 + markup.length) + text.after newtext = (
text.before.substring(0, (index)) + "\n" +
text.before.substring(index + 1 + markup.length) + text.after
)
i = 0 i = 0
for char in text.before for char in text.before
if char == "\n" and i != 0 if char == "\n" and i != 0
...@@ -190,12 +199,18 @@ markdown = ['$filter', '$timeout', ($filter, $timeout) -> ...@@ -190,12 +199,18 @@ markdown = ['$filter', '$timeout', ($filter, $timeout) ->
insertMarkup(newtext, start, end) insertMarkup(newtext, start, end)
# Check to see if markup has already been inserted and undo it. # Check to see if markup has already been inserted and undo it.
else if text.before.slice((index + 1), (index + 1 + markup.length)) == markup else if text.before.slice((index + 1), (index + 1 + markup.length)) == markup
newtext = text.before.substring(0, (index)) + "\n" + text.before.substring(index + 1 + markup.length) + text.after newtext = (
text.before.substring(0, (index)) + "\n" +
text.before.substring(index + 1 + markup.length) + text.after
)
start = text.before.length - markup.length start = text.before.length - markup.length
end = text.before.length - markup.length end = text.before.length - markup.length
insertMarkup(newtext, start, end) insertMarkup(newtext, start, end)
else else
newtext = text.before.substring(0, (index)) + "\n" + markup + text.before.substring(index + 1) + text.after newtext = (
text.before.substring(0, (index)) + "\n" +
markup + text.before.substring(index + 1) + text.after
)
start = (text.before + markup).length start = (text.before + markup).length
end = (text.before + markup).length end = (text.before + markup).length
insertMarkup(newtext, start, end) insertMarkup(newtext, start, end)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment