int videletechar(char **args) { int n = zmult; startvichange(-1); /* handle negative argument */ if (n < 0) { int ret; zmult = -n; ret = vibackwarddeletechar(args); zmult = n; return ret; } /* it is an error to be on the end of line */ if (zlecs == zlell || zleline[zlecs] == '\n') return 1; /* Put argument into the acceptable range -- it is not an error to * * specify a greater count than the number of available characters. */ /* HERE: we should do the test properly with INCPOS(). */ if (n > findeol() - zlecs) { n = findeol() - zlecs; /* do the deletion */ forekill(n, CUT_RAW); } else { forekill(n, 0); } return 0; }
int killregion(UNUSED(char **args)) { if (mark > zlell) mark = zlell; if (region_active == 2) { int a, b; regionlines(&a, &b); zlecs = a; region_active = 0; cut(zlecs, b - zlecs, CUT_RAW); shiftchars(zlecs, b - zlecs); if (zlell) { if (zlecs == zlell) DECCS(); foredel(1, 0); vifirstnonblank(zlenoargs); } } else if (mark > zlecs) { if (invicmdmode()) INCPOS(mark); forekill(mark - zlecs, CUT_RAW); } else { if (invicmdmode()) INCCS(); backkill(zlecs - mark, CUT_FRONT|CUT_RAW); } return 0; }
int vichangeeol(UNUSED(char **args)) { forekill(findeol() - zlecs, CUT_RAW); startvitext(1); return 0; }
int killbuffer(UNUSED(char **args)) { zlecs = 0; forekill(zlell, CUT_RAW); clearlist = 1; return 0; }
void killregion() /**/ { if (mark > ll) mark = ll; if (mark > cs) forekill(mark-cs,0); else backkill(cs-mark,1); }
int killregion(UNUSED(char **args)) { if (mark > zlell) mark = zlell; if (mark > zlecs) forekill(mark - zlecs, CUT_RAW); else backkill(zlecs - mark, CUT_FRONT|CUT_RAW); return 0; }
void backwardkillline() /**/ { int i = 0; if (mult < 0) { mult = -mult; killline(); return; } while (mult--) { while (cs && line[cs-1] != '\n') cs--,i++; if (mult && cs && line[cs-1] == '\n') cs--,i++; } forekill(i,1); }
int vikilleol(UNUSED(char **args)) { int n = findeol() - zlecs; startvichange(-1); if (!n) { /* error -- line already empty */ return 1; } /* delete to end of line */ forekill(findeol() - zlecs, CUT_RAW); return 0; }
void vikilleol(void) { int n = findeol() - cs; startvichange(-1); if (!n) { /* error -- line already empty */ feep(); return; } /* delete to end of line */ forekill(findeol() - cs, 0); }
void killwholeline() /**/ { int i,fg; if (mult < 0) return; while (mult--) { if (fg = (cs && cs == ll)) cs--; while (cs && line[cs-1] != '\n') cs--; for (i = cs; i != ll && line[i] != '\n'; i++); forekill(i-cs+(i != ll),fg); } }
void vichange(void) { int c2; startvichange(1); if ((c2 = getvirange(1)) != -1) { forekill(c2 - cs, 0); bindtab = mainbindtab; viinsbegin = cs; undoing = 0; } vilinerange = 0; }
int vichangeeol(UNUSED(char **args)) { int a, b; if (region_active) { regionlines(&a, &b); zlecs = a; region_active = 0; cut(zlecs, b - zlecs, CUT_RAW); shiftchars(zlecs, b - zlecs); } else forekill(findeol() - zlecs, CUT_RAW); startvitext(1); return 0; }
int vichange(UNUSED(char **args)) { int c2, ret = 1; startvichange(1); if ((c2 = getvirange(1)) != -1) { ret = 0; forekill(c2 - zlecs, CUT_RAW); selectkeymap("main", 1); viinsbegin = zlecs; vistartchange = (curchange && curchange->prev) ? curchange->prev->changeno : 0; } return ret; }
int vichange(UNUSED(char **args)) { int c2, ret = 1; startvichange(1); if ((c2 = getvirange(1)) != -1) { ret = 0; forekill(c2 - zlecs, CUT_RAW); selectkeymap("main", 1); viinsbegin = zlecs; undoing = 0; } return ret; }
void videlete(void) { int c2; startvichange(1); if ((c2 = getvirange(0)) != -1) { forekill(c2 - cs, 0); if (vilinerange && ll) { if (cs == ll) cs--; foredel(1); vifirstnonblank(); } } vichgflag = vilinerange = 0; }
int killwholeline(UNUSED(char **args)) { int i, fg, n = zmult; if (n < 0) return 1; while (n--) { if ((fg = (zlecs && zlecs == zlell))) zlecs--; while (zlecs && zleline[zlecs - 1] != '\n') zlecs--; for (i = zlecs; i != zlell && zleline[i] != '\n'; i++); forekill(i - zlecs + (i != zlell), fg ? (CUT_FRONT|CUT_RAW) : CUT_RAW); } clearlist = 1; return 0; }
int videlete(UNUSED(char **args)) { int c2, ret = 1; startvichange(1); if ((c2 = getvirange(0)) != -1) { forekill(c2 - zlecs, CUT_RAW); ret = 0; if (vilinerange && zlell) { if (zlecs == zlell) DECCS(); foredel(1, 0); vifirstnonblank(zlenoargs); } } vichgflag = 0; return ret; }
int visubstitute(UNUSED(char **args)) { int n = zmult; startvichange(1); if (n < 0) return 1; /* it is an error to be on the end of line */ if (zlecs == zlell || zleline[zlecs] == '\n') return 1; /* Put argument into the acceptable range -- it is not an error to * * specify a greater count than the number of available characters. */ if (n > findeol() - zlecs) n = findeol() - zlecs; /* do the substitution */ forekill(n, CUT_RAW); startvitext(1); return 0; }
void visubstitute(void) { startvichange(1); if (zmult < 0) { feep(); return; } /* it is an error to be on the end of line */ if (cs == ll || line[cs] == '\n') { feep(); return; } /* Put argument into the acceptable range -- it is not an error to * * specify a greater count than the number of available characters. */ if (zmult > findeol() - cs) zmult = findeol() - cs; /* do the substitution */ forekill(zmult, 0); startvitext(1); }
void videletechar(void) { startvichange(-1); /* handle negative argument */ if (zmult < 0) { zmult = -zmult; vibackwarddeletechar(); return; } /* it is an error to be on the end of line */ if (cs == ll || line[cs] == '\n') { feep(); return; } /* Put argument into the acceptable range -- it is not an error to * * specify a greater count than the number of available characters. */ if (zmult > findeol() - cs) zmult = findeol() - cs; /* do the deletion */ forekill(zmult, 0); }
int killword(char **args) { int x = zlecs; int n = zmult; if (n < 0) { int ret; zmult = -n; ret = backwardkillword(args); zmult = n; return ret; } while (n--) { while (x != zlell && !ZC_iword(zleline[x])) INCPOS(x); while (x != zlell && ZC_iword(zleline[x])) INCPOS(x); } forekill(x - zlecs, CUT_RAW); return 0; }
int backwardkillline(char **args) { int i = 0, n = zmult; if (n < 0) { int ret; zmult = -n; ret = killline(args); zmult = n; return ret; } while (n--) { if (zlecs && zleline[zlecs - 1] == '\n') zlecs--, i++; else while (zlecs && zleline[zlecs - 1] != '\n') zlecs--, i++; } forekill(i, CUT_FRONT|CUT_RAW); clearlist = 1; return 0; }
void killbuffer() /**/ { cs = 0; forekill(ll,0); }
void vichangeeol(void) { forekill(findeol() - cs, 0); startvitext(1); }