mirror of
https://github.com/gryf/wmaker.git
synced 2026-01-10 15:54:17 +01:00
*** empty log message ***
This commit is contained in:
@@ -29,18 +29,15 @@
|
|||||||
/* TODO:
|
/* TODO:
|
||||||
*
|
*
|
||||||
* - FIX wrap... long lines that don't fit are not char wrapped yet.
|
* - FIX wrap... long lines that don't fit are not char wrapped yet.
|
||||||
|
* - check if support for Horizontal Scroll is complete
|
||||||
* - FIX html parser: 1. <b>foo</i> should STILL BE BOLD!
|
* - FIX html parser: 1. <b>foo</i> should STILL BE BOLD!
|
||||||
* - 2. " foo > bar " should not confuse it.
|
* - 2. " foo > bar " should not confuse it.
|
||||||
* - change Array stuffs to WMArray
|
|
||||||
* - assess danger of destroying widgets whose actions link to other pages
|
* - assess danger of destroying widgets whose actions link to other pages
|
||||||
* - integrate WMConvertFontTo* functions into WINGs proper (fontpanel)?
|
|
||||||
* - change cursor shape around pixmaps
|
* - change cursor shape around pixmaps
|
||||||
* - redo blink code to reduce paint event... use pixmap buffer...
|
* - redo blink code to reduce paint event... use pixmap buffer...
|
||||||
* - add paragraph support (full) and '\n' code in getStream..
|
* - add paragraph support (full) and '\n' code in getStream..
|
||||||
* - use currentTextBlock and neighbours for fast paint and layout
|
* - use currentTextBlock and neighbours for fast paint and layout
|
||||||
* - replace copious uses of Refreshtext with appropriate layOut()...
|
* - replace copious uses of Refreshtext with appropriate layOut()...
|
||||||
* - WMFindInTextStream should also highlight found text...
|
|
||||||
* - add full support for Horizontal Scroll
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -255,23 +252,22 @@ mystrchr(char *s, char needle, unsigned short len)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* tb->text doesn't necessarily end in '\0' hmph! (strstr) */
|
|
||||||
|
/* tb->text doesn't necessarily end in '\0' hmph! (strchr) */
|
||||||
static inline char *
|
static inline char *
|
||||||
mystrstr(char *haystack, char *needle, unsigned short len)
|
mystrrstr(char *haystack, char *needle, unsigned short len, char *end)
|
||||||
{
|
{
|
||||||
if (!haystack || !needle || len < 1) {
|
char *ptr;
|
||||||
|
|
||||||
|
if(!haystack || !needle)
|
||||||
return NULL;
|
return NULL;
|
||||||
} else {
|
|
||||||
char *s = wmalloc(len+1);
|
for (ptr = haystack; ptr > end; ptr--) {
|
||||||
char *r;
|
if (*ptr == *needle && !strncmp(ptr, needle, len))
|
||||||
|
return ptr;
|
||||||
memcpy(s, haystack, len);
|
}
|
||||||
s[len] = 0;
|
return NULL;
|
||||||
r = (strstr(s, needle));
|
}
|
||||||
wfree(s);
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
mystrcasecmp(const unsigned char *s1, const unsigned char *s2,
|
mystrcasecmp(const unsigned char *s1, const unsigned char *s2,
|
||||||
@@ -849,7 +845,6 @@ updateCursorPosition(Text *tPtr)
|
|||||||
tPtr->cursor.y = y;
|
tPtr->cursor.y = y;
|
||||||
tPtr->cursor.h = h;
|
tPtr->cursor.h = h;
|
||||||
tPtr->cursor.x = x;
|
tPtr->cursor.x = x;
|
||||||
paintText(tPtr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1114,7 +1109,7 @@ output(&tb->text[start], tPtr->tpos - start);
|
|||||||
x -= WMWidthOfString(font, &tb->text[start],
|
x -= WMWidthOfString(font, &tb->text[start],
|
||||||
tPtr->tpos - start);
|
tPtr->tpos - start);
|
||||||
}
|
}
|
||||||
tPtr->sel.x = (x<0?0:x);
|
tPtr->sel.x = (x<0?0:x)+1;
|
||||||
|
|
||||||
if((mark = mystrchr(&tb->text[start], ' ', tb->used-start))) {
|
if((mark = mystrchr(&tb->text[start], ' ', tb->used-start))) {
|
||||||
tPtr->sel.w = WMWidthOfString(font, &tb->text[start],
|
tPtr->sel.w = WMWidthOfString(font, &tb->text[start],
|
||||||
@@ -2002,6 +1997,8 @@ handleTextKeyPress(Text *tPtr, XEvent *event)
|
|||||||
switch(ksym) {
|
switch(ksym) {
|
||||||
|
|
||||||
case XK_Left:
|
case XK_Left:
|
||||||
|
printf("foind %d \n", WMFindInTextStream(tPtr, "ion", 0, 0));
|
||||||
|
return;
|
||||||
if(!(tb = tPtr->currentTextBlock))
|
if(!(tb = tPtr->currentTextBlock))
|
||||||
break;
|
break;
|
||||||
if(tb->graphic)
|
if(tb->graphic)
|
||||||
@@ -2014,10 +2011,11 @@ L_imaGFX: if(tb->prior) {
|
|||||||
} else tPtr->tpos = 0;
|
} else tPtr->tpos = 0;
|
||||||
} else tPtr->tpos--;
|
} else tPtr->tpos--;
|
||||||
updateCursorPosition(tPtr);
|
updateCursorPosition(tPtr);
|
||||||
|
paintText(tPtr);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case XK_Right:
|
case XK_Right:
|
||||||
printf("foind %d \n", WMFindInTextStream(tPtr, "It", 1, 0));
|
printf("foind %d \n", WMFindInTextStream(tPtr, "ion", 1, 0));
|
||||||
return;
|
return;
|
||||||
if(!(tb = tPtr->currentTextBlock))
|
if(!(tb = tPtr->currentTextBlock))
|
||||||
break;
|
break;
|
||||||
@@ -2030,6 +2028,7 @@ R_imaGFX: if(tb->next) {
|
|||||||
} else tPtr->tpos = tb->used;
|
} else tPtr->tpos = tb->used;
|
||||||
} else tPtr->tpos++;
|
} else tPtr->tpos++;
|
||||||
updateCursorPosition(tPtr);
|
updateCursorPosition(tPtr);
|
||||||
|
paintText(tPtr);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case XK_Down:
|
case XK_Down:
|
||||||
@@ -2049,6 +2048,7 @@ R_imaGFX: if(tb->next) {
|
|||||||
case XK_KP_Delete:
|
case XK_KP_Delete:
|
||||||
deleteTextInteractively(tPtr, ksym);
|
deleteTextInteractively(tPtr, ksym);
|
||||||
updateCursorPosition(tPtr);
|
updateCursorPosition(tPtr);
|
||||||
|
paintText(tPtr);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case XK_Control_R :
|
case XK_Control_R :
|
||||||
@@ -2062,6 +2062,7 @@ R_imaGFX: if(tb->next) {
|
|||||||
if (buffer[0] != 0 && !control_pressed) {
|
if (buffer[0] != 0 && !control_pressed) {
|
||||||
insertTextInteractively(tPtr, buffer, 1);
|
insertTextInteractively(tPtr, buffer, 1);
|
||||||
updateCursorPosition(tPtr);
|
updateCursorPosition(tPtr);
|
||||||
|
paintText(tPtr);
|
||||||
|
|
||||||
} else if (control_pressed && ksym==XK_r) {
|
} else if (control_pressed && ksym==XK_r) {
|
||||||
Bool i = !tPtr->flags.rulerShown;
|
Bool i = !tPtr->flags.rulerShown;
|
||||||
@@ -3669,8 +3670,8 @@ Bool
|
|||||||
WMFindInTextStream(WMText *tPtr, char *needle, Bool direction,
|
WMFindInTextStream(WMText *tPtr, char *needle, Bool direction,
|
||||||
Bool caseSensitive)
|
Bool caseSensitive)
|
||||||
{
|
{
|
||||||
TextBlock *tb = NULL;
|
TextBlock *tb;
|
||||||
char *haystack = NULL, *mark = NULL;
|
char *s, *mark;
|
||||||
unsigned short pos;
|
unsigned short pos;
|
||||||
|
|
||||||
if (!tPtr || !needle)
|
if (!tPtr || !needle)
|
||||||
@@ -3682,26 +3683,54 @@ WMFindInTextStream(WMText *tPtr, char *needle, Bool direction,
|
|||||||
return False;
|
return False;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(tb != ((direction>0) ?tPtr->firstTextBlock : tPtr->lastTextBlock))
|
//if(tb != ((direction>0) ?tPtr->firstTextBlock : tPtr->lastTextBlock))
|
||||||
tb = (direction>0) ? tb->next : tb->prior;
|
// tb = (direction>0) ? tb->next : tb->prior;
|
||||||
|
if(tb != tPtr->lastTextBlock)
|
||||||
|
tb = tb->prior;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("\n%p\n\n", tb);
|
|
||||||
|
|
||||||
while(tb) {
|
while(tb) {
|
||||||
if (!tb->graphic) {
|
if (!tb->graphic) {
|
||||||
pos = tPtr->tpos;
|
pos = tPtr->tpos;
|
||||||
if(pos+1 < tb->used)
|
if(pos+1 < tb->used)
|
||||||
pos++;
|
pos++;
|
||||||
printf("here\n");
|
pos--;
|
||||||
output(tb->text, tb->used);
|
if(tb->used - pos> 0 && pos > 0) {
|
||||||
mark = strstr(&tb->text[pos], needle); //, tb->used);
|
char tmp = tb->text[tb->used];
|
||||||
|
tb->text[tb->used] = 0;
|
||||||
|
|
||||||
|
if(direction > 0)
|
||||||
|
mark = strstr(&tb->text[pos], needle);
|
||||||
|
else
|
||||||
|
mark = mystrrstr(&tb->text[pos], needle,
|
||||||
|
strlen(needle), tb->text);
|
||||||
|
|
||||||
|
tb->text[tb->used] = tmp;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
return False;
|
||||||
|
}
|
||||||
|
|
||||||
if(mark) {
|
if(mark) {
|
||||||
tPtr->currentTextBlock = tb;
|
WMFont *font = tPtr->flags.monoFont?tPtr->dFont:tb->d.font;
|
||||||
|
|
||||||
tPtr->tpos = (int)(mark - tb->text);
|
tPtr->tpos = (int)(mark - tb->text);
|
||||||
|
|
||||||
|
tPtr->currentTextBlock = tb;
|
||||||
updateCursorPosition(tPtr);
|
updateCursorPosition(tPtr);
|
||||||
|
tPtr->sel.y = tPtr->cursor.y+5;
|
||||||
|
tPtr->sel.h = tPtr->cursor.h-10;
|
||||||
|
tPtr->sel.x = tPtr->cursor.x +1;
|
||||||
|
tPtr->sel.w = WMIN(WMWidthOfString(font,
|
||||||
|
&tb->text[tPtr->tpos], strlen(needle)),
|
||||||
|
tPtr->docWidth - tPtr->sel.x);
|
||||||
|
tPtr->flags.ownsSelection = True;
|
||||||
|
paintText(tPtr);
|
||||||
|
|
||||||
return True;
|
return True;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
tb = (direction>0) ? tb->next : tb->prior;
|
tb = (direction>0) ? tb->next : tb->prior;
|
||||||
pos = 0;
|
pos = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user