mirror of
https://github.com/fltk/fltk.git
synced 2026-05-28 20:06:18 +08:00
FLUID: Adds wrapping to "find" in source view.
This commit is contained in:
@@ -32,7 +32,7 @@ extern void reveal_in_browser(Fl_Type *t);
|
|||||||
/**
|
/**
|
||||||
Update the header and source code highlighting depending on the
|
Update the header and source code highlighting depending on the
|
||||||
currently selected object
|
currently selected object
|
||||||
|
|
||||||
The Source View system offers an immediate preview of the code
|
The Source View system offers an immediate preview of the code
|
||||||
files that will be generated by FLUID. It also marks the code
|
files that will be generated by FLUID. It also marks the code
|
||||||
generated for the last selected item in the header and the source
|
generated for the last selected item in the header and the source
|
||||||
@@ -309,6 +309,8 @@ static void cb_(Fl_Button*, void*) {
|
|||||||
int pos = e->insert_position()-1;
|
int pos = e->insert_position()-1;
|
||||||
if (pos < 0) pos = b->length()-1;
|
if (pos < 0) pos = b->length()-1;
|
||||||
int found = b->search_backward(pos, needle, &pos, sv_find_text_case->value());
|
int found = b->search_backward(pos, needle, &pos, sv_find_text_case->value());
|
||||||
|
if (!found)
|
||||||
|
found = b->search_backward(b->length()-1, needle, &pos, sv_find_text_case->value());
|
||||||
if (found) {
|
if (found) {
|
||||||
b->select(pos, pos + (int)strlen(needle));
|
b->select(pos, pos + (int)strlen(needle));
|
||||||
e->insert_position(pos);
|
e->insert_position(pos);
|
||||||
@@ -332,6 +334,8 @@ static void cb_1(Fl_Button*, void*) {
|
|||||||
int pos = e->insert_position() + 1;
|
int pos = e->insert_position() + 1;
|
||||||
if (pos+1 >= b->length()) pos = 0;
|
if (pos+1 >= b->length()) pos = 0;
|
||||||
int found = b->search_forward(pos, needle, &pos, sv_find_text_case->value());
|
int found = b->search_forward(pos, needle, &pos, sv_find_text_case->value());
|
||||||
|
if (!found && (pos > 0))
|
||||||
|
found = b->search_forward(0, needle, &pos, sv_find_text_case->value());
|
||||||
if (found) {
|
if (found) {
|
||||||
b->select(pos, pos + (int)strlen(needle));
|
b->select(pos, pos + (int)strlen(needle));
|
||||||
e->insert_position(pos);
|
e->insert_position(pos);
|
||||||
|
|||||||
@@ -152,8 +152,7 @@ file.} open return_type void
|
|||||||
sv_project->scroll(line, 0);
|
sv_project->scroll(line, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}} {selected
|
}} {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Function {update_sourceview_position_cb(class Fl_Tabs*, void*)} {
|
Function {update_sourceview_position_cb(class Fl_Tabs*, void*)} {
|
||||||
@@ -383,12 +382,14 @@ if (e) {
|
|||||||
int pos = e->insert_position()-1;
|
int pos = e->insert_position()-1;
|
||||||
if (pos < 0) pos = b->length()-1;
|
if (pos < 0) pos = b->length()-1;
|
||||||
int found = b->search_backward(pos, needle, &pos, sv_find_text_case->value());
|
int found = b->search_backward(pos, needle, &pos, sv_find_text_case->value());
|
||||||
|
if (!found)
|
||||||
|
found = b->search_backward(b->length()-1, needle, &pos, sv_find_text_case->value());
|
||||||
if (found) {
|
if (found) {
|
||||||
b->select(pos, pos + (int)strlen(needle));
|
b->select(pos, pos + (int)strlen(needle));
|
||||||
e->insert_position(pos);
|
e->insert_position(pos);
|
||||||
e->show_insert_position();
|
e->show_insert_position();
|
||||||
}
|
}
|
||||||
}}
|
}} selected
|
||||||
xywh {273 460 25 20} labelsize 11
|
xywh {273 460 25 20} labelsize 11
|
||||||
}
|
}
|
||||||
Fl_Button {} {
|
Fl_Button {} {
|
||||||
@@ -407,6 +408,8 @@ if (e) {
|
|||||||
int pos = e->insert_position() + 1;
|
int pos = e->insert_position() + 1;
|
||||||
if (pos+1 >= b->length()) pos = 0;
|
if (pos+1 >= b->length()) pos = 0;
|
||||||
int found = b->search_forward(pos, needle, &pos, sv_find_text_case->value());
|
int found = b->search_forward(pos, needle, &pos, sv_find_text_case->value());
|
||||||
|
if (!found && (pos > 0))
|
||||||
|
found = b->search_forward(0, needle, &pos, sv_find_text_case->value());
|
||||||
if (found) {
|
if (found) {
|
||||||
b->select(pos, pos + (int)strlen(needle));
|
b->select(pos, pos + (int)strlen(needle));
|
||||||
e->insert_position(pos);
|
e->insert_position(pos);
|
||||||
|
|||||||
Reference in New Issue
Block a user