refactor(misc1): move out misc functions which obviously belong elsewhere

Also make some function names more descriptive/regular.
This commit is contained in:
Björn Linse
2021-12-09 21:23:03 +01:00
parent 51822f0655
commit d9c1669a54
10 changed files with 73 additions and 82 deletions

View File

@@ -1841,6 +1841,17 @@ char_u *ml_get_pos(const pos_T *pos)
return ml_get_buf(curbuf, pos->lnum, false) + pos->col;
}
/// get codepoint at pos. pos must be either valid or have col set to MAXCOL!
int gchar_pos(pos_T *pos)
FUNC_ATTR_NONNULL_ARG(1)
{
// When searching columns is sometimes put at the end of a line.
if (pos->col == MAXCOL) {
return NUL;
}
return utf_ptr2char(ml_get_pos(pos));
}
/// Return a pointer to a line in a specific buffer
///
/// @param will_change true mark the buffer dirty (chars in the line will be changed)