mirror of
https://gitea.nishi.boats/pyrite-dev/milsko
synced 2026-01-04 08:30:51 +00:00
fix bug
git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@725 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
@@ -102,6 +102,7 @@ struct _MwMenu {
|
|||||||
struct _MwEntry {
|
struct _MwEntry {
|
||||||
int cursor;
|
int cursor;
|
||||||
int right;
|
int right;
|
||||||
|
int length;
|
||||||
MwPoint mouse;
|
MwPoint mouse;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -343,8 +343,8 @@ MwWidget MwColorPicker(MwWidget handle, const char* title) {
|
|||||||
color_picker_t* wheel;
|
color_picker_t* wheel;
|
||||||
MwWidget window;
|
MwWidget window;
|
||||||
MwSizeHints sh;
|
MwSizeHints sh;
|
||||||
int ww = MwGetInteger(handle, MwNwidth);
|
int ww = handle == NULL ? 0 : MwGetInteger(handle, MwNwidth);
|
||||||
int wh = MwGetInteger(handle, MwNheight);
|
int wh = handle == NULL ? 0 : MwGetInteger(handle, MwNheight);
|
||||||
int wx;
|
int wx;
|
||||||
int wy;
|
int wy;
|
||||||
|
|
||||||
|
|||||||
@@ -459,8 +459,8 @@ static void scan(MwWidget handle, const char* path, int record) {
|
|||||||
MwWidget MwFileChooser(MwWidget handle, const char* title) {
|
MwWidget MwFileChooser(MwWidget handle, const char* title) {
|
||||||
MwWidget window;
|
MwWidget window;
|
||||||
MwPoint p;
|
MwPoint p;
|
||||||
int ww = MwGetInteger(handle, MwNwidth);
|
int ww = handle == NULL ? 0 : MwGetInteger(handle, MwNwidth);
|
||||||
int wh = MwGetInteger(handle, MwNheight);
|
int wh = handle == NULL ? 0 : MwGetInteger(handle, MwNheight);
|
||||||
int w, h;
|
int w, h;
|
||||||
filechooser_t* fc = malloc(sizeof(*fc));
|
filechooser_t* fc = malloc(sizeof(*fc));
|
||||||
char* path;
|
char* path;
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ static int create(MwWidget handle) {
|
|||||||
|
|
||||||
t->cursor = 0;
|
t->cursor = 0;
|
||||||
t->right = 0;
|
t->right = 0;
|
||||||
|
t->length = 0;
|
||||||
handle->internal = t;
|
handle->internal = t;
|
||||||
|
|
||||||
MwSetDefault(handle);
|
MwSetDefault(handle);
|
||||||
@@ -135,11 +136,24 @@ static void key(MwWidget handle, int code) {
|
|||||||
free(out);
|
free(out);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
t->length = MwUTF8Length(MwGetText(handle, MwNtext));
|
||||||
|
|
||||||
MwForceRender(handle);
|
MwForceRender(handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void prop_change(MwWidget handle, const char* prop) {
|
static void prop_change(MwWidget handle, const char* prop) {
|
||||||
if(strcmp(prop, MwNtext) == 0 || strcmp(prop, MwNhideInput) == 0) MwForceRender(handle);
|
if(strcmp(prop, MwNtext) == 0 || strcmp(prop, MwNhideInput) == 0) MwForceRender(handle);
|
||||||
|
|
||||||
|
if(strcmp(prop, MwNtext) == 0) {
|
||||||
|
MwEntry t = handle->internal;
|
||||||
|
int len = MwUTF8Length(MwGetText(handle, MwNtext));
|
||||||
|
if(len < t->cursor) {
|
||||||
|
t->cursor = len;
|
||||||
|
} else if(t->length == t->cursor) {
|
||||||
|
t->cursor = len;
|
||||||
|
}
|
||||||
|
t->length = len;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MwClassRec MwEntryClassRec = {
|
MwClassRec MwEntryClassRec = {
|
||||||
|
|||||||
@@ -458,6 +458,8 @@ static void mwListBoxResetImpl(MwWidget handle) {
|
|||||||
|
|
||||||
lb->selected = -1;
|
lb->selected = -1;
|
||||||
|
|
||||||
|
MwSetInteger(lb->vscroll, MwNvalue, 0);
|
||||||
|
|
||||||
resize(handle);
|
resize(handle);
|
||||||
MwForceRender(lb->frame);
|
MwForceRender(lb->frame);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user