aboutsummaryrefslogtreecommitdiff
path: root/modules/textadept
diff options
context:
space:
mode:
Diffstat (limited to 'modules/textadept')
-rw-r--r--modules/textadept/editing.lua4
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