summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fluid/CodeEditor.cxx7
-rw-r--r--fluid/Fl_Widget_Type.cxx3
-rw-r--r--src/Fl_File_Chooser.cxx2
-rw-r--r--src/Fl_File_Chooser.fl2
-rw-r--r--src/Fl_Valuator.cxx1
-rw-r--r--src/fl_draw_pixmap.cxx17
-rw-r--r--test/demo.cxx12
-rw-r--r--test/editor.cxx18
8 files changed, 39 insertions, 23 deletions
diff --git a/fluid/CodeEditor.cxx b/fluid/CodeEditor.cxx
index 38c23c3aa..af1e0c8ac 100644
--- a/fluid/CodeEditor.cxx
+++ b/fluid/CodeEditor.cxx
@@ -305,14 +305,17 @@ void CodeEditor::style_update(int pos, int nInserted, int nDeleted,
end = editor->mBuffer->line_end(pos + nInserted);
text = editor->mBuffer->text_range(start, end);
style = editor->mStyleBuffer->text_range(start, end);
- last = style[end - start - 1];
+ if (start==end)
+ last = 0;
+ else
+ last = style[end - start - 1];
style_parse(text, style, end - start);
editor->mStyleBuffer->replace(start, end, style);
editor->redisplay_range(start, end);
- if (last != style[end - start - 1]) {
+ if (start==end || last != style[end - start - 1]) {
// The last character on the line changed styles, so reparse the
// remainder of the buffer...
free(text);
diff --git a/fluid/Fl_Widget_Type.cxx b/fluid/Fl_Widget_Type.cxx
index d5f3f0e36..3cd8e1a34 100644
--- a/fluid/Fl_Widget_Type.cxx
+++ b/fluid/Fl_Widget_Type.cxx
@@ -1332,6 +1332,7 @@ void min_w_cb(Fl_Value_Input* i, void* v) {
void min_h_cb(Fl_Value_Input* i, void* v) {
if (v == LOAD) {
+ if (!current_widget->is_window()) return;
i->value(((Fl_Window_Type*)current_widget)->sr_min_h);
} else {
int mod = 0;
@@ -1348,6 +1349,7 @@ void min_h_cb(Fl_Value_Input* i, void* v) {
void max_w_cb(Fl_Value_Input* i, void* v) {
if (v == LOAD) {
+ if (!current_widget->is_window()) return;
i->value(((Fl_Window_Type*)current_widget)->sr_max_w);
} else {
int mod = 0;
@@ -1364,6 +1366,7 @@ void max_w_cb(Fl_Value_Input* i, void* v) {
void max_h_cb(Fl_Value_Input* i, void* v) {
if (v == LOAD) {
+ if (!current_widget->is_window()) return;
i->value(((Fl_Window_Type*)current_widget)->sr_max_h);
} else {
int mod = 0;
diff --git a/src/Fl_File_Chooser.cxx b/src/Fl_File_Chooser.cxx
index ba54213bd..356e97dde 100644
--- a/src/Fl_File_Chooser.cxx
+++ b/src/Fl_File_Chooser.cxx
@@ -359,7 +359,7 @@ const char * Fl_File_Chooser::label() {
void Fl_File_Chooser::ok_label(const char *l) {
okButton->label(l);
-int w, h;
+int w=0, h=0;
okButton->measure_label(w, h);
okButton->resize(cancelButton->x() - 50 - w, cancelButton->y(),
w + 40, 25);
diff --git a/src/Fl_File_Chooser.fl b/src/Fl_File_Chooser.fl
index 982811bae..8cbd9f588 100644
--- a/src/Fl_File_Chooser.fl
+++ b/src/Fl_File_Chooser.fl
@@ -283,7 +283,7 @@ showChoiceCB();} {}
Function {ok_label(const char *l)} {return_type void
} {
code {okButton->label(l);
-int w, h;
+int w=0, h=0;
okButton->measure_label(w, h);
okButton->resize(cancelButton->x() - 50 - w, cancelButton->y(),
w + 40, 25);
diff --git a/src/Fl_Valuator.cxx b/src/Fl_Valuator.cxx
index d08813651..296951022 100644
--- a/src/Fl_Valuator.cxx
+++ b/src/Fl_Valuator.cxx
@@ -38,6 +38,7 @@ Fl_Valuator::Fl_Valuator(int X, int Y, int W, int H, const char* L)
align(FL_ALIGN_BOTTOM);
when(FL_WHEN_CHANGED);
value_ = 0;
+ previous_value_ = 1;
min = 0;
max = 1;
A = 0.0;
diff --git a/src/fl_draw_pixmap.cxx b/src/fl_draw_pixmap.cxx
index 20cc293c0..a1fb81d8a 100644
--- a/src/fl_draw_pixmap.cxx
+++ b/src/fl_draw_pixmap.cxx
@@ -263,15 +263,16 @@ int fl_draw_pixmap(const char*const* di, int x, int y, Fl_Color bg) {
for (int Y = 0; Y < d.h; Y++) {
const uchar* p = data[Y];
if (chars_per_pixel <= 1) {
+ int dw = d.w;
for (int X = 0; X < W; X++) {
- uchar b = (*p++ != transparent_index);
- if (*p++ != transparent_index) b |= 2;
- if (*p++ != transparent_index) b |= 4;
- if (*p++ != transparent_index) b |= 8;
- if (*p++ != transparent_index) b |= 16;
- if (*p++ != transparent_index) b |= 32;
- if (*p++ != transparent_index) b |= 64;
- if (*p++ != transparent_index) b |= 128;
+ uchar b = (dw-->0 && *p++ != transparent_index);
+ if (dw-->0 && *p++ != transparent_index) b |= 2;
+ if (dw-->0 && *p++ != transparent_index) b |= 4;
+ if (dw-->0 && *p++ != transparent_index) b |= 8;
+ if (dw-->0 && *p++ != transparent_index) b |= 16;
+ if (dw-->0 && *p++ != transparent_index) b |= 32;
+ if (dw-->0 && *p++ != transparent_index) b |= 64;
+ if (dw-->0 && *p++ != transparent_index) b |= 128;
*bitmap++ = b;
}
} else {
diff --git a/test/demo.cxx b/test/demo.cxx
index 9c3c5714e..ece3369bd 100644
--- a/test/demo.cxx
+++ b/test/demo.cxx
@@ -182,7 +182,8 @@ void push_menu(const char* nnn)
if (menus[men].icommand[i][0] != '@') but[bn]->tooltip(menus[men].icommand[i]);
else but[bn]->tooltip(0);
}
- strcpy(stack[stsize],nnn);
+ if (stack[stsize]!=nnn)
+ strcpy(stack[stsize],nnn);
stsize++;
}
@@ -255,8 +256,8 @@ void dobut(Fl_Widget *, long arg)
CreateProcess(NULL, command, NULL, NULL, FALSE,
NORMAL_PRIORITY_CLASS, NULL, NULL, &suInfo, &prInfo);
- delete command;
- delete copy_of_icommand;
+ delete[] command;
+ delete[] copy_of_icommand;
#else // NON WIN32 systems.
@@ -266,7 +267,7 @@ void dobut(Fl_Widget *, long arg)
sprintf(command, "./%s &", menus[men].icommand[bn]);
system(command);
- delete command;
+ delete[] command;
#endif // WIN32
}
}
@@ -336,7 +337,8 @@ int main(int argc, char **argv) {
if (i < argc) fname = argv[i];
if (!load_the_menu(fname)) Fl::fatal("Can't open %s",fname);
- strcpy(buf,fname);
+ if (buf!=fname)
+ strcpy(buf,fname);
const char *c = fl_filename_name(buf);
if (c > buf) {buf[c-buf] = 0; chdir(buf);}
push_menu("@main");
diff --git a/test/editor.cxx b/test/editor.cxx
index 34d77e0ae..e8c1f42ae 100644
--- a/test/editor.cxx
+++ b/test/editor.cxx
@@ -379,20 +379,26 @@ style_update(int pos, // I - Position of update
end = textbuf->line_end(pos + nInserted);
text = textbuf->text_range(start, end);
style = stylebuf->text_range(start, end);
- last = style[end - start - 1];
+ if (start==end)
+ last = 0;
+ else
+ last = style[end - start - 1];
-// printf("start = %d, end = %d, text = \"%s\", style = \"%s\"...\n",
-// start, end, text, style);
+// printf("start = %d, end = %d, text = \"%s\", style = \"%s\", last='%c'...\n",
+// start, end, text, style, last);
style_parse(text, style, end - start);
-// printf("new style = \"%s\"...\n", style);
+// printf("new style = \"%s\", new last='%c'...\n",
+// style, style[end - start - 1]);
stylebuf->replace(start, end, style);
((Fl_Text_Editor *)cbArg)->redisplay_range(start, end);
- if (last != style[end - start - 1]) {
- // The last character on the line changed styles, so reparse the
+ if (start==end || last != style[end - start - 1]) {
+// printf("Recalculate the rest of the buffer style\n");
+ // Either the user deleted some text, or the last character
+ // on the line changed styles, so reparse the
// remainder of the buffer...
free(text);
free(style);