mirror of
https://github.com/gryf/wmaker.git
synced 2026-01-29 11:35:47 +01:00
restoring copy of wtext.c to cvs (wif ssh)
This commit is contained in:
@@ -1289,7 +1289,7 @@ updateScrollers(Text *tPtr)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (tPtr->vS) {
|
if (tPtr->vS) {
|
||||||
if (tPtr->docHeight < tPtr->visible.h) {
|
if (tPtr->docHeight <= tPtr->visible.h) {
|
||||||
WMSetScrollerParameters(tPtr->vS, 0, 1);
|
WMSetScrollerParameters(tPtr->vS, 0, 1);
|
||||||
tPtr->vpos = 0;
|
tPtr->vpos = 0;
|
||||||
} else {
|
} else {
|
||||||
@@ -1301,7 +1301,7 @@ updateScrollers(Text *tPtr)
|
|||||||
} else tPtr->vpos = 0;
|
} else tPtr->vpos = 0;
|
||||||
|
|
||||||
if (tPtr->hS) {
|
if (tPtr->hS) {
|
||||||
if (tPtr->docWidth < tPtr->visible.w) {
|
if (tPtr->docWidth <= tPtr->visible.w) {
|
||||||
WMSetScrollerParameters(tPtr->hS, 0, 1);
|
WMSetScrollerParameters(tPtr->hS, 0, 1);
|
||||||
tPtr->hpos = 0;
|
tPtr->hpos = 0;
|
||||||
} else {
|
} else {
|
||||||
@@ -2026,6 +2026,8 @@ insertTextInteractively(Text *tPtr, char *text, int len)
|
|||||||
int nlen = (int)(newline-text);
|
int nlen = (int)(newline-text);
|
||||||
int s = tb->used - tPtr->tpos;
|
int s = tb->used - tPtr->tpos;
|
||||||
char save[s];
|
char save[s];
|
||||||
|
|
||||||
|
|
||||||
if (!tb->blank && nlen>0) {
|
if (!tb->blank && nlen>0) {
|
||||||
if (s > 0) {
|
if (s > 0) {
|
||||||
memcpy(save, &tb->text[tPtr->tpos], s);
|
memcpy(save, &tb->text[tPtr->tpos], s);
|
||||||
@@ -2041,14 +2043,20 @@ insertTextInteractively(Text *tPtr, char *text, int len)
|
|||||||
if (tPtr->tpos>0 && tPtr->tpos < tb->used
|
if (tPtr->tpos>0 && tPtr->tpos < tb->used
|
||||||
&& !tb->graphic && tb->text) {
|
&& !tb->graphic && tb->text) {
|
||||||
|
|
||||||
|
unsigned short savePos = tPtr->tpos;
|
||||||
void *ntb = WMCreateTextBlockWithText(
|
void *ntb = WMCreateTextBlockWithText(
|
||||||
tPtr, &tb->text[tPtr->tpos],
|
tPtr, &tb->text[tPtr->tpos],
|
||||||
tb->d.font, tb->color, True, tb->used - tPtr->tpos);
|
tb->d.font, tb->color, True, tb->used - tPtr->tpos);
|
||||||
tb->used = tPtr->tpos;
|
|
||||||
|
if(tb->sections[0].end == tPtr->tpos)
|
||||||
|
WMAppendTextBlock(tPtr, WMCreateTextBlockWithText(tPtr,
|
||||||
|
NULL, tb->d.font, tb->color, True, 0));
|
||||||
|
|
||||||
|
tb->used = savePos;
|
||||||
WMAppendTextBlock(tPtr, ntb);
|
WMAppendTextBlock(tPtr, ntb);
|
||||||
tPtr->tpos = 0;
|
tPtr->tpos = 0;
|
||||||
|
|
||||||
} else if (tPtr->tpos == tb->used || tPtr->tpos == 0) {
|
} else if (tPtr->tpos == tb->used) {
|
||||||
if(tPtr->flags.indentNewLine) {
|
if(tPtr->flags.indentNewLine) {
|
||||||
WMAppendTextBlock(tPtr, WMCreateTextBlockWithText(tPtr,
|
WMAppendTextBlock(tPtr, WMCreateTextBlockWithText(tPtr,
|
||||||
" ", tb->d.font, tb->color, True, 4));
|
" ", tb->d.font, tb->color, True, 4));
|
||||||
@@ -2058,7 +2066,18 @@ insertTextInteractively(Text *tPtr, char *text, int len)
|
|||||||
NULL, tb->d.font, tb->color, True, 0));
|
NULL, tb->d.font, tb->color, True, 0));
|
||||||
tPtr->tpos = 0;
|
tPtr->tpos = 0;
|
||||||
}
|
}
|
||||||
}
|
} else if (tPtr->tpos == 0) {
|
||||||
|
if(tPtr->flags.indentNewLine) {
|
||||||
|
WMPrependTextBlock(tPtr, WMCreateTextBlockWithText(tPtr,
|
||||||
|
" ", tb->d.font, tb->color, True, 4));
|
||||||
|
} else {
|
||||||
|
WMPrependTextBlock(tPtr, WMCreateTextBlockWithText(tPtr,
|
||||||
|
NULL, tb->d.font, tb->color, True, 0));
|
||||||
|
}
|
||||||
|
tPtr->tpos = 0;
|
||||||
|
if(tPtr->currentTextBlock->next)
|
||||||
|
tPtr->currentTextBlock = tPtr->currentTextBlock->next;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -3490,12 +3509,10 @@ WMPrependTextBlock(WMText *tPtr, void *vtb)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
WMAddToArray(tPtr->gfxItems, (void *)tb);
|
WMAddToArray(tPtr->gfxItems, (void *)tb);
|
||||||
tPtr->tpos = 0;
|
tPtr->tpos = 1;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if(tb->graphic)
|
tPtr->tpos = tb->used;
|
||||||
tPtr->tpos = 1;
|
|
||||||
else
|
|
||||||
tPtr->tpos = tb->used;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!tPtr->lastTextBlock || !tPtr->firstTextBlock) {
|
if (!tPtr->lastTextBlock || !tPtr->firstTextBlock) {
|
||||||
@@ -3541,13 +3558,10 @@ WMAppendTextBlock(WMText *tPtr, void *vtb)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
WMAddToArray(tPtr->gfxItems, (void *)tb);
|
WMAddToArray(tPtr->gfxItems, (void *)tb);
|
||||||
tPtr->tpos = 0;
|
tPtr->tpos = 1;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if(tb->graphic)
|
tPtr->tpos = tb->used;
|
||||||
tPtr->tpos = 1;
|
|
||||||
else
|
|
||||||
tPtr->tpos = tb->used;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user