本文整理汇总了C++中spaceinline函数的典型用法代码示例。如果您正苦于以下问题:C++ spaceinline函数的具体用法?C++ spaceinline怎么用?C++ spaceinline使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了spaceinline函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: viputafter
int
viputafter(UNUSED(char **args))
{
Cutbuffer buf = &cutbuf;
int n = zmult;
startvichange(-1);
if (n < 0)
return 1;
if (zmod.flags & MOD_VIBUF)
buf = &vibuf[zmod.vibuf];
if (!buf->buf)
return 1;
if(buf->flags & CUTBUFFER_LINE) {
zlecs = findeol();
spaceinline(buf->len + 1);
zleline[zlecs++] = ZWC('\n');
ZS_memcpy(zleline + zlecs, buf->buf, buf->len);
vifirstnonblank(zlenoargs);
} else {
if (zlecs != findeol())
INCCS();
while (n--) {
spaceinline(buf->len);
ZS_memcpy(zleline + zlecs, buf->buf, buf->len);
zlecs += buf->len;
}
if (zlecs)
DECCS();
}
return 0;
}
示例2: viputafter
void
viputafter(void)
{
Cutbuffer buf = &cutbuf;
startvichange(-1);
if (zmult < 0)
return;
if (gotvibufspec)
buf = &vibuf[vibufspec];
if (!buf->buf) {
feep();
return;
}
vilinerange = !!(buf->flags & CUTBUFFER_LINE);
if (vilinerange) {
cs = findeol();
spaceinline(buf->len + 1);
line[cs++] = '\n';
memcpy((char *)line + cs, buf->buf, buf->len);
vifirstnonblank();
} else {
if (cs != findeol())
cs++;
while (zmult--) {
spaceinline(buf->len);
memcpy((char *)line + cs, buf->buf, buf->len);
cs += buf->len;
}
if (cs)
cs--;
}
}
示例3: poundinsert
int
poundinsert(UNUSED(char **args))
{
zlecs = 0;
vifirstnonblank(zlenoargs);
if (zleline[zlecs] != '#') {
spaceinline(1);
zleline[zlecs] = '#';
zlecs = findeol();
while(zlecs != zlell) {
zlecs++;
vifirstnonblank(zlenoargs);
spaceinline(1);
zleline[zlecs] = '#';
zlecs = findeol();
}
} else {
foredel(1, 0);
zlecs = findeol();
while(zlecs != zlell) {
zlecs++;
vifirstnonblank(zlenoargs);
if(zleline[zlecs] == '#')
foredel(1, 0);
zlecs = findeol();
}
}
done = 1;
return 0;
}
示例4: selfinsert
void selfinsert() /**/
{
int ncs = cs+mult;
if (mult < 0) { mult = -mult; ncs = cs; }
if (insmode || ll == cs)
spaceinline(mult);
else if (mult+cs > ll)
spaceinline(ll-(mult+cs));
while (mult--)
line[cs++] = c;
cs = ncs;
}
示例5: viindent
int
viindent(UNUSED(char **args))
{
int oldcs = zlecs, c2;
/* get the range */
startvichange(1);
if ((c2 = getvirange(0)) == -1) {
vichgflag = 0;
return 1;
}
vichgflag = 0;
/* must be a line range */
if (!vilinerange) {
zlecs = oldcs;
return 1;
}
oldcs = zlecs;
/* add a tab to the beginning of each line within range */
while (zlecs < c2) {
spaceinline(1);
zleline[zlecs] = '\t';
zlecs = findeol() + 1;
}
/* go back to the first line of the range */
zlecs = oldcs;
vifirstnonblank(zlenoargs);
return 0;
}
示例6: viquotedinsert
int
viquotedinsert(char **args)
{
#ifndef HAS_TIO
struct sgttyb sob;
#endif
spaceinline(1);
zleline[zlecs] = '^';
zrefresh();
#ifndef HAS_TIO
sob = shttyinfo.sgttyb;
sob.sg_flags = (sob.sg_flags | RAW) & ~ECHO;
ioctl(SHTTY, TIOCSETN, &sob);
#endif
getfullchar(0);
#ifndef HAS_TIO
zsetterm();
#endif
foredel(1, 0);
if(LASTFULLCHAR == ZLEEOF)
return 1;
else
return selfinsert(args);
}
示例7: yank
void yank() /**/
{
int cc;
char *buf = cutbuf;
if (!cutbuf) {
feep();
return;
}
if (mult < 0) return;
if (vibufspec) {
vibufspec = tolower(vibufspec);
vibufspec += (idigit(vibufspec)) ? -'1'+26 : -'a';
if (!(buf = vibuf[vibufspec])) {
feep();
vibufspec = 0;
return;
}
vibufspec = 0;
}
yankb = cs;
while (mult--) {
kct = kringnum;
cc = strlen(buf);
spaceinline(cc);
strncpy((char *) line+cs,buf,cc);
cs += cc;
yanke = cs;
}
}
示例8: vireplacechars
int
vireplacechars(UNUSED(char **args))
{
ZLE_INT_T ch;
int n = zmult, fail = 0, newchars = 0;
if (n > 0) {
int pos = zlecs;
while (n-- > 0) {
if (pos == zlell || zleline[pos] == ZWC('\n')) {
fail = 1;
break;
}
newchars++;
INCPOS(pos);
}
n = pos - zlecs;
}
startvichange(1);
/* check argument range */
if (n < 1 || fail) {
if(vichgrepeat)
vigetkey();
if(vichgflag) {
free(vichgbuf);
vichgbuf = NULL;
vichgflag = 0;
}
return 1;
}
/* get key */
if((ch = vigetkey()) == ZLEEOF) {
vichgflag = 0;
return 1;
}
/* do change */
if (ch == ZWC('\r') || ch == ZWC('\n')) {
/* <return> handled specially */
zlecs += n - 1;
backkill(n - 1, CUT_RAW);
zleline[zlecs++] = '\n';
} else {
/*
* Make sure we delete displayed characters, including
* attach combining characters. n includes this as a raw
* buffer offset.
* Use shiftchars so as not to adjust the cursor position;
* we are overwriting anything that remains directly.
*/
if (n > newchars)
shiftchars(zlecs, n - newchars);
else if (n < newchars)
spaceinline(newchars - n);
while (newchars--)
zleline[zlecs++] = ch;
zlecs--;
}
vichgflag = 0;
return 0;
}
示例9: viquotedinsert
void
viquotedinsert(void)
{
#ifndef WINNT
#ifndef HAS_TIO
struct sgttyb sob;
#endif
#endif /* WINNT */
spaceinline(1);
line[cs] = '^';
refresh();
#ifndef WINNT
#ifndef HAS_TIO
sob = shttyinfo.sgttyb;
sob.sg_flags = (sob.sg_flags | RAW) & ~ECHO;
ioctl(SHTTY, TIOCSETN, &sob);
#endif
#endif /* WINNT */
c = getkey(0);
#ifndef WINNT
#ifndef HAS_TIO
setterm();
#endif
#endif /* WINNT */
foredel(1);
if(c < 0)
feep();
else
selfinsert();
}
示例10: copyprevshellword
int
copyprevshellword(UNUSED(char **args))
{
LinkList l;
LinkNode n;
int i;
char *p = NULL;
if (zmult <= 0)
return 1;
if ((l = bufferwords(NULL, NULL, &i, LEXFLAGS_ZLE))) {
i -= (zmult-1);
if (i < 0)
return 1;
for (n = firstnode(l); n; incnode(n))
if (!i--) {
p = getdata(n);
break;
}
}
if (p) {
int len;
ZLE_STRING_T lineadd = stringaszleline(p, 0, &len, NULL, NULL);
spaceinline(len);
ZS_memcpy(zleline + zlecs, lineadd, len);
zlecs += len;
free(lineadd);
}
return 0;
}
示例11: quoteregion
int
quoteregion(UNUSED(char **args))
{
ZLE_STRING_T str;
size_t len;
int extra = invicmdmode();
if (mark > zlell)
mark = zlell;
if (region_active == 2) {
int a, b;
regionlines(&a, &b);
zlecs = a;
mark = b;
extra = 0;
} else if (mark < zlecs) {
int tmp = mark;
mark = zlecs;
zlecs = tmp;
}
if (extra)
INCPOS(mark);
str = (ZLE_STRING_T)hcalloc((len = mark - zlecs) *
ZLE_CHAR_SIZE);
ZS_memcpy(str, zleline + zlecs, len);
foredel(len, CUT_RAW);
str = makequote(str, &len);
spaceinline(len);
ZS_memcpy(zleline + zlecs, str, len);
mark = zlecs;
zlecs += len;
return 0;
}
示例12: viindent
void
viindent(void)
{
int oldcs = cs, c2;
/* get the range */
startvichange(1);
if ((c2 = getvirange(0)) == -1) {
vichgflag = vilinerange = 0;
return;
}
vichgflag = 0;
/* must be a line range */
if (!vilinerange) {
feep();
cs = oldcs;
return;
}
vilinerange = 0;
oldcs = cs;
/* add a tab to the beginning of each line within range */
while (cs < c2) {
spaceinline(1);
line[cs] = '\t';
cs = findeol() + 1;
}
/* go back to the first line of the range */
cs = oldcs;
vifirstnonblank();
}
示例13: vijoin
int
vijoin(UNUSED(char **args))
{
int x, pos;
startvichange(-1);
if ((x = findeol()) == zlell)
return 1;
zlecs = x + 1;
pos = zlecs;
for (; zlecs != zlell && ZC_iblank(zleline[zlecs]); INCPOS(zlecs))
;
x = 1 + (zlecs - pos);
backdel(x, CUT_RAW);
if (zlecs) {
int pos = zlecs;
DECPOS(pos);
if (ZC_iblank(zleline[pos])) {
zlecs = pos;
return 0;
}
}
spaceinline(1);
zleline[zlecs] = ZWC(' ');
return 0;
}
示例14: vipoundinsert
int
vipoundinsert(UNUSED(char **args))
{
int oldcs = zlecs;
startvichange(-1);
vifirstnonblank(zlenoargs);
if(zleline[zlecs] != '#') {
spaceinline(1);
zleline[zlecs] = '#';
if(zlecs <= viinsbegin)
INCPOS(viinsbegin);
if (zlecs <= oldcs)
INCPOS(oldcs);
zlecs = oldcs;
} else {
foredel(1, 0);
if (zlecs < viinsbegin)
DECPOS(viinsbegin);
if (zlecs < oldcs)
DECPOS(oldcs);
zlecs = oldcs;
}
return 0;
}
示例15: pastebuf
/* position: 0 is before, 1 after, 2 split the line */
static void pastebuf(Cutbuffer buf, int mult, int position)
{
int cc;
if (buf->flags & CUTBUFFER_LINE) {
if (position == 2) {
if (!zlecs)
position = 0;
else if (zlecs == zlell)
position = 1;
}
if (position == 2) {
yankb = zlecs;
spaceinline(buf->len + 2);
zleline[zlecs++] = ZWC('\n');
ZS_memcpy(zleline + zlecs, buf->buf, buf->len);
zlecs += buf->len;
zleline[zlecs] = ZWC('\n');
yanke = zlecs + 1;
} else if (position != 0) {
yankb = zlecs = findeol();
spaceinline(buf->len + 1);
zleline[zlecs++] = ZWC('\n');
yanke = zlecs + buf->len;
ZS_memcpy(zleline + zlecs, buf->buf, buf->len);
} else {
yankb = zlecs = findbol();
spaceinline(buf->len + 1);
ZS_memcpy(zleline + zlecs, buf->buf, buf->len);
yanke = zlecs + buf->len + 1;
zleline[zlecs + buf->len] = ZWC('\n');
}
vifirstnonblank(zlenoargs);
} else {
if (position == 1 && zlecs != findeol())
INCCS();
yankb = zlecs;
cc = buf->len;
while (mult--) {
spaceinline(cc);
ZS_memcpy(zleline + zlecs, buf->buf, cc);
zlecs += cc;
}
yanke = zlecs;
if (zlecs && invicmdmode())
DECCS();
}
}