diff options
author | 2016-04-05 20:49:23 -0400 | |
---|---|---|
committer | 2016-04-05 20:49:23 -0400 | |
commit | 47d8b1a2beba8a737c325fcfe95050f399fdeaf9 (patch) | |
tree | 9c2858dfb426b8b219993de72aaaab8db69f0eef /modules/textadept | |
parent | dd67ffe17bc8b1a472124a72783f557c61473fef (diff) | |
download | textadept-47d8b1a2beba8a737c325fcfe95050f399fdeaf9.tar.gz textadept-47d8b1a2beba8a737c325fcfe95050f399fdeaf9.zip |
Fixed indentation conversion; modules/textadept/editing.lua
Use mixture of tabs and spaces when necessary in order to preserve indentation
amount.
Diffstat (limited to 'modules/textadept')
-rw-r--r-- | modules/textadept/editing.lua | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/modules/textadept/editing.lua b/modules/textadept/editing.lua index d024808b..00f8edcb 100644 --- a/modules/textadept/editing.lua +++ b/modules/textadept/editing.lua @@ -441,7 +441,9 @@ function M.convert_indentation() local current_indentation, new_indentation = buffer:text_range(s, e), nil if buffer.use_tabs then -- Need integer division and LuaJIT does not have // operator. - new_indentation = string.rep('\t', math.floor(indent / buffer.tab_width)) + local tabs = math.floor(indent / buffer.tab_width) + local spaces = math.fmod(indent, buffer.tab_width) + new_indentation = string.rep('\t', tabs)..string.rep(' ', spaces) else new_indentation = string.rep(' ', indent) end |