Beispiel #1
0
/// Overwrite the current redo and cursor characters + left adjust
///
/// @param c
static void put_curr_and_l_to_X(int c)
{
  int tempc;

  if (curwin->w_p_rl && p_ri) {
    return;
  }

  if ((curwin->w_cursor.col < (colnr_T)STRLEN(ml_get_curline()))) {
    if ((p_ri && curwin->w_cursor.col) || !p_ri) {
      if (p_ri) {
        dec_cursor();
      } else {
        inc_cursor();
      }

      if (F_is_TyC_TyD((tempc = gchar_cursor()))) {
        pchar_cursor(toF_TyB(tempc));
        AppendCharToRedobuff(K_BS);
        AppendCharToRedobuff(tempc);
      }

      if (p_ri) {
        inc_cursor();
      } else {
        dec_cursor();
      }
    }
  }

  put_and_redo(c);
}
Beispiel #2
0
/// Change the char. under the cursor to a _X_ or X_ type
static void chg_c_to_X_orX_(void)
{
  int tempc;

  switch (gchar_cursor()) {
    case ALEF:
      tempc = ALEF_;
      break;

    case ALEF_U_H:
      tempc = ALEF_U_H_;
      break;

    case _AYN:
      tempc = _AYN_;
      break;

    case AYN:
      tempc = AYN_;
      break;

    case _GHAYN:
      tempc = _GHAYN_;
      break;

    case GHAYN:
      tempc = GHAYN_;
      break;

    case _HE:
      tempc = _HE_;
      break;

    case YE:
      tempc = YE_;
      break;

    case IE:
      tempc = IE_;
      break;

    case TEE:
      tempc = TEE_;
      break;

    case YEE:
      tempc = YEE_;
      break;

    default:
      tempc = 0;
  }

  if (tempc) {
    put_and_redo(tempc);
  }
}
Beispiel #3
0
/// Change the char. under the cursor to a _X_ or _X type
static void chg_c_to_X_or_X(void)
{
  int tempc;

  tempc = gchar_cursor();

  if (curwin->w_cursor.col + 1 < (colnr_T)STRLEN(get_cursor_line_ptr())) {
    inc_cursor();
    if ((tempc == F_HE) && (F_is_TyB_TyC_TyD(SRC_EDT, AT_CURSOR))) {
      tempc = _HE_;
      dec_cursor();
      put_and_redo((char_u)tempc);
      return;
    }
    dec_cursor();
  }

  if ((tempc = toF_Xor_X_(tempc)) != 0) {
    put_and_redo((char_u)tempc);
  }
}
Beispiel #4
0
static void chg_r_to_Xor_X_(void)                 {
  int tempc, c;

  if (curwin->w_cursor.col) {
    if (!p_ri)
      dec_cursor();

    tempc = gchar_cursor();

    if ((c = toF_Xor_X_(tempc)) != 0)
      put_and_redo(c);

    if (!p_ri)
      inc_cursor();

  }
}
Beispiel #5
0
/// Change the character left to the cursor to a X or _X type
static void chg_l_toXor_X(void)
{
  char_u tempc;

  if ((curwin->w_cursor.col != 0)
      && (curwin->w_cursor.col + 1 == (colnr_T)STRLEN(get_cursor_line_ptr()))) {
    return;
  }

  if (!curwin->w_cursor.col && p_ri) {
    return;
  }

  if (p_ri) {
    dec_cursor();
  } else {
    inc_cursor();
  }

  switch (gchar_cursor()) {
    case ALEF_     : tempc = ALEF     ; break;
    case ALEF_U_H_ : tempc = ALEF_U_H ; break;
    case _AYN_     : tempc = _AYN     ; break;
    case AYN_      : tempc = AYN      ; break;
    case _GHAYN_   : tempc = _GHAYN   ; break;
    case GHAYN_    : tempc = GHAYN    ; break;
    case _HE_      : tempc = _HE      ; break;
    case YE_       : tempc = YE       ; break;
    case IE_       : tempc = IE       ; break;
    case TEE_      : tempc = TEE      ; break;
    case YEE_      : tempc = YEE      ; break;
    default        : tempc = 0        ;
  }

  if (tempc) {
    put_and_redo(tempc);
  }

  if (p_ri) {
    inc_cursor();
  } else {
    dec_cursor();
  }
}
Beispiel #6
0
/// Change the character left to the cursor to a _X_ or X_ type
static void chg_l_to_X_orX_(void)
{
  int tempc;

  if ((curwin->w_cursor.col != 0)
      && (curwin->w_cursor.col + 1 == (colnr_T)STRLEN(ml_get_curline()))) {
    return;
  }

  if (!curwin->w_cursor.col && p_ri) {
    return;
  }

  if (p_ri) {
    dec_cursor();
  } else {
    inc_cursor();
  }

  switch (gchar_cursor()) {
    case ALEF:
      tempc = ALEF_;
      break;

    case ALEF_U_H:
      tempc = ALEF_U_H_;
      break;

    case _AYN:
      tempc = _AYN_;
      break;

    case AYN:
      tempc = AYN_;
      break;

    case _GHAYN:
      tempc = _GHAYN_;
      break;

    case GHAYN:
      tempc = GHAYN_;
      break;

    case _HE:
      tempc = _HE_;
      break;

    case YE:
      tempc = YE_;
      break;

    case IE:
      tempc = IE_;
      break;

    case TEE:
      tempc = TEE_;
      break;

    case YEE:
      tempc = YEE_;
      break;

    default:
      tempc = 0;
  }

  if (tempc) {
    put_and_redo(tempc);
  }

  if (p_ri) {
    inc_cursor();
  } else {
    dec_cursor();
  }
}
Beispiel #7
0
/// Change the char. under the cursor to a X_ or X type
static void chg_c_toX_orX(void)
{
  int tempc, curc;

  switch ((curc = gchar_cursor())) {
    case _BE:
      tempc = BE;
      break;

    case _PE:
      tempc = PE;
      break;

    case _TE:
      tempc = TE;
      break;

    case _SE:
      tempc = SE;
      break;

    case _JIM:
      tempc = JIM;
      break;

    case _CHE:
      tempc = CHE;
      break;

    case _HE_J:
      tempc = HE_J;
      break;

    case _XE:
      tempc = XE;
      break;

    case _SIN:
      tempc = SIN;
      break;

    case _SHIN:
      tempc = SHIN;
      break;

    case _SAD:
      tempc = SAD;
      break;

    case _ZAD:
      tempc = ZAD;
      break;

    case _FE:
      tempc = FE;
      break;

    case _GHAF:
      tempc = GHAF;
      break;

    case _KAF_H:
    case _KAF:
      tempc = KAF;
      break;

    case _GAF:
      tempc = GAF;
      break;

    case _AYN:
      tempc = AYN;
      break;

    case _AYN_:
      tempc = AYN_;
      break;

    case _GHAYN:
      tempc = GHAYN;
      break;

    case _GHAYN_:
      tempc = GHAYN_;
      break;

    case _LAM:
      tempc = LAM;
      break;

    case _MIM:
      tempc = MIM;
      break;

    case _NOON:
      tempc = NOON;
      break;

    case _HE:
    case _HE_:
      tempc = F_HE;
      break;

    case _YE:
    case _IE:
    case _YEE:
      if (p_ri) {
        inc_cursor();

        if (F_is_TyB_TyC_TyD(SRC_EDT, AT_CURSOR)) {
          tempc = (curc == _YE ? YE_ :
                   (curc == _IE ? IE_ : YEE_));
        } else {
          tempc = (curc == _YE ? YE :
                   (curc == _IE ? IE : YEE));
        }
        dec_cursor();
      } else {
        if (curwin->w_cursor.col) {
          dec_cursor();

          if (F_is_TyB_TyC_TyD(SRC_EDT, AT_CURSOR)) {
            tempc = (curc == _YE ? YE_ :
                     (curc == _IE ? IE_ : YEE_));
          } else {
            tempc = (curc == _YE ? YE :
                     (curc == _IE ? IE : YEE));
          }
          inc_cursor();
        } else {
          tempc = (curc == _YE ? YE :
                   (curc == _IE ? IE : YEE));
        }
      }
      break;

    default:
      tempc = 0;
  }

  if (tempc) {
    put_and_redo(tempc);
  }
}
Beispiel #8
0
static void chg_l_toXor_X(void)                 {
  int tempc;

  if (curwin->w_cursor.col != 0 &&
      (curwin->w_cursor.col + 1 == (colnr_T)STRLEN(ml_get_curline())))
    return;

  if (!curwin->w_cursor.col && p_ri)
    return;

  if (p_ri)
    dec_cursor();
  else
    inc_cursor();

  switch (gchar_cursor()) {
  case ALEF_:
    tempc = ALEF;
    break;
  case ALEF_U_H_:
    tempc = ALEF_U_H;
    break;
  case _AYN_:
    tempc = _AYN;
    break;
  case AYN_:
    tempc = AYN;
    break;
  case _GHAYN_:
    tempc = _GHAYN;
    break;
  case GHAYN_:
    tempc = GHAYN;
    break;
  case _HE_:
    tempc = _HE;
    break;
  case YE_:
    tempc = YE;
    break;
  case IE_:
    tempc = IE;
    break;
  case TEE_:
    tempc = TEE;
    break;
  case YEE_:
    tempc = YEE;
    break;
  default:
    tempc = 0;
  }

  if (tempc)
    put_and_redo(tempc);

  if (p_ri)
    inc_cursor();
  else
    dec_cursor();
}