Beispiel #1
0
/*
 * Try to advance the Cursor to the specified screen column.
 * If virtual editing: fine tune the cursor position.
 * Note that all virtual positions off the end of a line should share
 * a curwin->w_cursor.col value (n.b. this is equal to STRLEN(line)),
 * beginning at coladd 0.
 *
 * return OK if desired column is reached, FAIL if not
 */
int coladvance(colnr_T wcol)
{
  int rc = getvpos(&curwin->w_cursor, wcol);

  if (wcol == MAXCOL || rc == FAIL)
    curwin->w_valid &= ~VALID_VIRTCOL;
  else if (*get_cursor_pos_ptr() != TAB) {
    /* Virtcol is valid when not on a TAB */
    curwin->w_valid |= VALID_VIRTCOL;
    curwin->w_virtcol = wcol;
  }
  return rc;
}
Beispiel #2
0
int gchar_cursor(void)
{
  return utf_ptr2char(get_cursor_pos_ptr());
}
Beispiel #3
0
int gchar_cursor(void)
{
  if (has_mbyte)
    return (*mb_ptr2char)(get_cursor_pos_ptr());
  return (int)*get_cursor_pos_ptr();
}