diff options
| author | Matthias Melcher <fltk@matthiasm.com> | 2010-11-06 23:58:57 +0000 |
|---|---|---|
| committer | Matthias Melcher <fltk@matthiasm.com> | 2010-11-06 23:58:57 +0000 |
| commit | f0993114811eef4e4dee703d4ebb4769c21f3ff9 (patch) | |
| tree | 4441b3f322655de6e0a1158943669897211eb60b | |
| parent | 213318ccb3f5012da07b143e29a5dc5c8b5192de (diff) | |
Better alignment testing
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7807 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
| -rw-r--r-- | FL/Fl_Text_Buffer.H | 2 | ||||
| -rw-r--r-- | src/Fl_Text_Buffer.cxx | 2 | ||||
| -rw-r--r-- | test/editor.cxx | 2 |
3 files changed, 5 insertions, 1 deletions
diff --git a/FL/Fl_Text_Buffer.H b/FL/Fl_Text_Buffer.H index 25ce72b79..cc9e0be70 100644 --- a/FL/Fl_Text_Buffer.H +++ b/FL/Fl_Text_Buffer.H @@ -39,8 +39,10 @@ #ifdef ASSERT_UTF8 # include <assert.h> # define IS_UTF8_ALIGNED(a) if (a && *a) assert(fl_utf8len(*(a))>0); +# define IS_UTF8_ALIGNED2(a, b) if (b>=0 && b<a->length()) assert(fl_utf8len(a->byte_at(b))>0); #else # define IS_UTF8_ALIGNED(a) +# define IS_UTF8_ALIGNED2(a, b) #endif diff --git a/src/Fl_Text_Buffer.cxx b/src/Fl_Text_Buffer.cxx index 6c3386fa3..531ec5029 100644 --- a/src/Fl_Text_Buffer.cxx +++ b/src/Fl_Text_Buffer.cxx @@ -1287,7 +1287,7 @@ void Fl_Text_Buffer::replace_selection_(Fl_Text_Selection * sel, void Fl_Text_Buffer::call_modify_callbacks(int pos, int nDeleted, int nInserted, int nRestyled, const char *deletedText) const { - IS_UTF8_ALIGNED(address(pos)) + IS_UTF8_ALIGNED2(this, pos) for (int i = 0; i < mNModifyProcs; i++) (*mModifyProcs[i]) (pos, nInserted, nDeleted, nRestyled, deletedText, mCbArgs[i]); diff --git a/test/editor.cxx b/test/editor.cxx index 98d41f280..ace60b9fa 100644 --- a/test/editor.cxx +++ b/test/editor.cxx @@ -805,6 +805,7 @@ Fl_Window* new_view() { int main(int argc, char **argv) { textbuf = new Fl_Text_Buffer; +#if 1 textbuf->text( "void saveas_cb() {\n" " Fl_Native_File_Chooser fnfc;\n" @@ -848,6 +849,7 @@ int main(int argc, char **argv) { "And superficial dreams / Shall no longer delude you.\n" "(from Iroha-uta)" ); +#endif style_init(); Fl_Window* window = new_view(); |
