Update Note_Write_Helper.xml

Contrast_Picker
Arcidayne 9 years ago
parent bd92a1bae1
commit 0ec71d40d1

@ -81,22 +81,29 @@ function note_wrap(str, limit, indent, indent1)
indent1 = indent1 or indent
limit = limit or 79
local here = 1-#indent1
local last_color = ''
return indent1..str:gsub("(%s+)()(%S+)()",
function(sp, st, word, fi)
local delta = 0
word:gsub('@([@%a])',
function(c)
if c == '@' then delta = delta + 1
elseif c == 'x' then delta = delta + 5
else delta = delta + 2
end
end)
here = here + delta
if fi-here > limit then
here = st - #indent + delta
return "\n"..indent..word
end
end)
function(sp, st, word, fi)
local delta = 0
local color_before_current_word = last_color
word:gsub('()@([@%a])',
function(pos, c)
if c == '@' then
delta = delta + 1
elseif c == 'x' then
delta = delta + 5
last_color = word:sub(pos, pos+4)
else
delta = delta + 2
last_color = word:sub(pos, pos+1)
end
end)
here = here + delta
if fi-here > limit then
here = st - #indent + delta
return "\n"..indent..color_before_current_word..word
end
end)
end
]]>
</script>

Loading…
Cancel
Save