本文整理汇总了C++中spaceinline函数的典型用法代码示例。如果您正苦于以下问题:C++ spaceinline函数的具体用法?C++ spaceinline怎么用?C++ spaceinline使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了spaceinline函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:Osse,项目名称:zsh,代码行数:32,代码来源:zle_vi.c
示例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--;
}
}
开发者ID:prabirshrestha,项目名称:winzsh,代码行数:34,代码来源:zle_vi.c
示例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;
}
开发者ID:MPOWER4RU,项目名称:zsh,代码行数:30,代码来源:zle_misc.c
示例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;
}
开发者ID:jonathangray,项目名称:386bsd,代码行数:13,代码来源:zle_misc.c
示例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;
}
开发者ID:Osse,项目名称:zsh,代码行数:29,代码来源:zle_vi.c
示例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);
}
开发者ID:Osse,项目名称:zsh,代码行数:25,代码来源:zle_vi.c
示例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;
}
}
开发者ID:jonathangray,项目名称:386bsd,代码行数:30,代码来源:zle_misc.c
示例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;
}
开发者ID:Osse,项目名称:zsh,代码行数:60,代码来源:zle_vi.c
示例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();
}
开发者ID:prabirshrestha,项目名称:winzsh,代码行数:31,代码来源:zle_vi.c
示例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;
}
开发者ID:MPOWER4RU,项目名称:zsh,代码行数:34,代码来源:zle_misc.c
示例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;
}
开发者ID:MPOWER4RU,项目名称:zsh,代码行数:33,代码来源:zle_misc.c
示例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();
}
开发者ID:prabirshrestha,项目名称:winzsh,代码行数:30,代码来源:zle_vi.c
示例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;
}
开发者ID:Osse,项目名称:zsh,代码行数:26,代码来源:zle_vi.c
示例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;
}
开发者ID:Osse,项目名称:zsh,代码行数:25,代码来源:zle_vi.c
示例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();
}
}
开发者ID:MPOWER4RU,项目名称:zsh,代码行数:48,代码来源:zle_misc.c
示例16: viopenlineabove
void
viopenlineabove(void)
{
cs = findbol();
spaceinline(1);
line[cs] = '\n';
startvitext(1);
}
开发者ID:redwinner,项目名称:unxutils,代码行数:8,代码来源:zle_vi.c
示例17: viopenlinebelow
void
viopenlinebelow(void)
{
cs = findeol();
spaceinline(1);
line[cs++] = '\n';
startvitext(1);
}
开发者ID:redwinner,项目名称:unxutils,代码行数:8,代码来源:zle_vi.c
示例18: yankpop
int
yankpop(UNUSED(char **args))
{
int cc, kctstart = kct;
Cutbuffer buf;
if (!(lastcmd & ZLE_YANK) || !kring || !kctbuf) {
kctbuf = NULL;
return 1;
}
do {
/*
* This is supposed to make the yankpop loop
* original buffer -> kill ring in order -> original buffer -> ...
* where the original buffer is -1 and the remainder are
* indices into the kill ring, remember that we need to start
* that at kringnum rather than zero.
*/
if (kct == -1)
kct = kringnum;
else {
int kctnew = (kct + kringsize - 1) % kringsize;
if (kctnew == kringnum)
kct = -1;
else
kct = kctnew;
}
if (kct == -1)
buf = kctbuf; /* Use original cutbuffer */
else
buf = kring+kct; /* Use somewhere in the kill ring */
/* Careful to prevent infinite looping */
if (kct == kctstart)
return 1;
/*
* Skip unset buffers instead of stopping as we used to do.
* Also skip zero-length buffers.
* There are two reasons for this:
* 1. We now map the array $killring directly into the
* killring, instead of via some extra size-checking logic.
* When $killring has been set, a buffer will always have
* at least a zero-length string in it.
* 2. The old logic was inconsistent; when the kill ring
* was full, we could loop round and round it, otherwise
* we just stopped when we hit the first empty buffer.
*/
} while (!buf->buf || *buf->buf == ZWC('\0'));
zlecs = yankb;
foredel(yanke - yankb, CUT_RAW);
cc = buf->len;
spaceinline(cc);
ZS_memcpy(zleline + zlecs, buf->buf, cc);
zlecs += cc;
yanke = zlecs;
return 0;
}
开发者ID:Jaharmi,项目名称:zsh,代码行数:57,代码来源:zle_misc.c
示例19: insertlastword
void
insertlastword(void)
{
int n;
char *s, *t;
int len;
Histent he;
/* multiple calls will now search back through the history, pem */
static char *lastinsert;
static int lasthist, lastpos;
int evhist = curhist - 1, save;
if (lastinsert) {
int lastlen = ztrlen(lastinsert);
int pos = cs;
if (lastpos <= pos &&
lastlen == pos - lastpos &&
memcmp(lastinsert, (char *)&line[lastpos], lastlen) == 0) {
evhist = --lasthist;
cs = lastpos;
foredel(pos - cs);
}
zsfree(lastinsert);
lastinsert = NULL;
}
if (!(he = quietgethist(evhist)) || !he->nwords) {
feep();
return;
}
if (zmult > 0) {
n = he->nwords - (zmult - 1);
} else {
n = 1 - zmult;
}
if (n < 1 || n > he->nwords) {
feep();
return;
}
s = he->text + he->words[2*n-2];
t = he->text + he->words[2*n-1];
save = *t;
*t = '\0'; /* ignore trailing whitespace */
lasthist = evhist;
lastpos = cs;
lastinsert = ztrdup(s);
spaceinline(len = ztrlen(s));
while (len--) {
line[cs++] = *s == Meta ? *++s ^ 32 : *s;
s++;
}
*t = save;
}
开发者ID:prabirshrestha,项目名称:winzsh,代码行数:56,代码来源:zle_hist.c
示例20: viopenlinebelow
int
viopenlinebelow(UNUSED(char **args))
{
zlecs = findeol();
spaceinline(1);
zleline[zlecs++] = '\n';
startvitext(1);
clearlist = 1;
return 0;
}
开发者ID:Osse,项目名称:zsh,代码行数:10,代码来源:zle_vi.c
注:本文中的spaceinline函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论