eval: Split eval.c into smaller files

This commit is contained in:
ZyX
2016-07-26 23:16:23 +03:00
parent 18e7d55200
commit fb146e80aa
51 changed files with 2763 additions and 2327 deletions

View File

@@ -50,6 +50,7 @@
#include "nvim/strings.h"
#include "nvim/os/os.h"
#include "nvim/arabic.h"
#include "nvim/mark.h"
typedef struct {
int rangeStart;
@@ -375,16 +376,18 @@ void remove_bom(char_u *s)
*/
int mb_get_class(const char_u *p)
{
return mb_get_class_buf(p, curbuf);
return mb_get_class_tab(p, curbuf->b_chartab);
}
int mb_get_class_buf(const char_u *p, buf_T *buf)
int mb_get_class_tab(const char_u *p, const uint64_t *const chartab)
{
if (MB_BYTE2LEN(p[0]) == 1) {
if (p[0] == NUL || ascii_iswhite(p[0]))
if (p[0] == NUL || ascii_iswhite(p[0])) {
return 0;
if (vim_iswordc_buf(p[0], buf))
}
if (vim_iswordc_tab(p[0], chartab)) {
return 2;
}
return 1;
}
return utf_class(utf_ptr2char(p));
@@ -1639,38 +1642,16 @@ theend:
*/
void mb_adjust_cursor(void)
{
mb_adjustpos(curbuf, &curwin->w_cursor);
}
/*
* Adjust position "*lp" to point to the first byte of a multi-byte character.
* If it points to a tail byte it's moved backwards to the head byte.
*/
void mb_adjustpos(buf_T *buf, pos_T *lp)
{
char_u *p;
if (lp->col > 0
|| lp->coladd > 1
) {
p = ml_get_buf(buf, lp->lnum, FALSE);
lp->col -= (*mb_head_off)(p, p + lp->col);
/* Reset "coladd" when the cursor would be on the right half of a
* double-wide character. */
if (lp->coladd == 1
&& p[lp->col] != TAB
&& vim_isprintc((*mb_ptr2char)(p + lp->col))
&& ptr2cells(p + lp->col) > 1)
lp->coladd = 0;
}
mark_mb_adjustpos(curbuf, &curwin->w_cursor);
}
/// Checks and adjusts cursor column. Not mode-dependent.
/// @see check_cursor_col_win
///
/// @param win Places cursor on a valid column for this window.
void mb_check_adjust_col(win_T *win)
/// @param win_ Places cursor on a valid column for this window.
void mb_check_adjust_col(void *win_)
{
win_T *win = (win_T *)win_;
colnr_T oldcol = win->w_cursor.col;
// Column 0 is always valid.