mirror of
https://github.com/gryf/wmaker.git
synced 2026-01-22 15:04:13 +01:00
FindTextInStream completed
This commit is contained in:
@@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
|
|
||||||
/* TODO:
|
/* TODO:
|
||||||
*
|
* - FIX: graphix blocks MUST be skipped if monoFont even though they exist!
|
||||||
* - 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
|
* - 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!
|
||||||
@@ -262,7 +262,7 @@ mystrrstr(char *haystack, char *needle, unsigned short len, char *end)
|
|||||||
if(!haystack || !needle)
|
if(!haystack || !needle)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
for (ptr = haystack; ptr > end; ptr--) {
|
for (ptr = haystack-2; ptr > end; ptr--) {
|
||||||
if (*ptr == *needle && !strncmp(ptr, needle, len))
|
if (*ptr == *needle && !strncmp(ptr, needle, len))
|
||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
@@ -1997,8 +1997,6 @@ 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)
|
||||||
@@ -2015,8 +2013,6 @@ L_imaGFX: if(tb->prior) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case XK_Right:
|
case XK_Right:
|
||||||
printf("foind %d \n", WMFindInTextStream(tPtr, "ion", 1, 0));
|
|
||||||
return;
|
|
||||||
if(!(tb = tPtr->currentTextBlock))
|
if(!(tb = tPtr->currentTextBlock))
|
||||||
break;
|
break;
|
||||||
if(tb->graphic)
|
if(tb->graphic)
|
||||||
@@ -3695,7 +3691,7 @@ WMFindInTextStream(WMText *tPtr, char *needle, Bool direction,
|
|||||||
pos = tPtr->tpos;
|
pos = tPtr->tpos;
|
||||||
if(pos+1 < tb->used)
|
if(pos+1 < tb->used)
|
||||||
pos++;
|
pos++;
|
||||||
pos--;
|
|
||||||
if(tb->used - pos> 0 && pos > 0) {
|
if(tb->used - pos> 0 && pos > 0) {
|
||||||
char tmp = tb->text[tb->used];
|
char tmp = tb->text[tb->used];
|
||||||
tb->text[tb->used] = 0;
|
tb->text[tb->used] = 0;
|
||||||
@@ -3705,7 +3701,6 @@ pos--;
|
|||||||
else
|
else
|
||||||
mark = mystrrstr(&tb->text[pos], needle,
|
mark = mystrrstr(&tb->text[pos], needle,
|
||||||
strlen(needle), tb->text);
|
strlen(needle), tb->text);
|
||||||
|
|
||||||
tb->text[tb->used] = tmp;
|
tb->text[tb->used] = tmp;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -3716,7 +3711,6 @@ pos--;
|
|||||||
WMFont *font = tPtr->flags.monoFont?tPtr->dFont:tb->d.font;
|
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;
|
tPtr->currentTextBlock = tb;
|
||||||
updateCursorPosition(tPtr);
|
updateCursorPosition(tPtr);
|
||||||
tPtr->sel.y = tPtr->cursor.y+5;
|
tPtr->sel.y = tPtr->cursor.y+5;
|
||||||
|
|||||||
Reference in New Issue
Block a user