aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/lua/executor.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-03-12 10:44:53 +0800
committerGitHub <noreply@github.com>2024-03-12 10:44:53 +0800
commitac8cd5368db83cced9bc049ceb50c21cb8a4f743 (patch)
tree8e0a97c534a79c97aa881002fd847be677e66f9c /src/nvim/lua/executor.c
parentb02a4d8ac39bafdbfd490bfbab35e3202e6f709c (diff)
downloadrneovim-ac8cd5368db83cced9bc049ceb50c21cb8a4f743.tar.gz
rneovim-ac8cd5368db83cced9bc049ceb50c21cb8a4f743.tar.bz2
rneovim-ac8cd5368db83cced9bc049ceb50c21cb8a4f743.zip
refactor: use ml_get_buf_len() in API code (#27825)
Diffstat (limited to 'src/nvim/lua/executor.c')
-rw-r--r--src/nvim/lua/executor.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/nvim/lua/executor.c b/src/nvim/lua/executor.c
index 1a9bd026b5..08677b77b0 100644
--- a/src/nvim/lua/executor.c
+++ b/src/nvim/lua/executor.c
@@ -1767,7 +1767,7 @@ void ex_luado(exarg_T *const eap)
lua_pushvalue(lstate, -1);
const char *const old_line = ml_get_buf(curbuf, l);
// Get length of old_line here as calling Lua code may free it.
- const size_t old_line_len = strlen(old_line);
+ const colnr_T old_line_len = ml_get_buf_len(curbuf, l);
lua_pushstring(lstate, old_line);
lua_pushnumber(lstate, (lua_Number)l);
if (nlua_pcall(lstate, 2, 1)) {
@@ -1791,7 +1791,7 @@ void ex_luado(exarg_T *const eap)
}
}
ml_replace(l, new_line_transformed, false);
- inserted_bytes(l, 0, (int)old_line_len, (int)new_line_len);
+ inserted_bytes(l, 0, old_line_len, (int)new_line_len);
}
lua_pop(lstate, 1);
}