diff options
| author | Matthias Melcher <fltk@matthiasm.com> | 2010-11-08 14:19:47 +0000 |
|---|---|---|
| committer | Matthias Melcher <fltk@matthiasm.com> | 2010-11-08 14:19:47 +0000 |
| commit | 6fbc3f3556f8e9acc734235a4fa4d7b56e3793f2 (patch) | |
| tree | 72ba45670f422c8b0f1382227585b893ab57c521 /src | |
| parent | d2f4577fc38175f7323c835211dc43cd1fef497d (diff) | |
Added smarter Macro to check for utf-8 violations in Fl_Text_*
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7810 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
| -rw-r--r-- | src/Fl_Text_Buffer.cxx | 64 | ||||
| -rw-r--r-- | src/Fl_Text_Display.cxx | 94 | ||||
| -rw-r--r-- | src/fl_utf8.cxx | 8 |
3 files changed, 83 insertions, 83 deletions
diff --git a/src/Fl_Text_Buffer.cxx b/src/Fl_Text_Buffer.cxx index 52666333e..fc22b57d2 100644 --- a/src/Fl_Text_Buffer.cxx +++ b/src/Fl_Text_Buffer.cxx @@ -196,8 +196,8 @@ void Fl_Text_Buffer::text(const char *t) Creates a range of text to a new buffer and copies verbose from around the gap. */ char *Fl_Text_Buffer::text_range(int start, int end) const { - IS_UTF8_ALIGNED(address(start)) - IS_UTF8_ALIGNED(address(start)) + IS_UTF8_ALIGNED2(this, (start)) + IS_UTF8_ALIGNED2(this, (start)) char *s = NULL; @@ -241,7 +241,7 @@ unsigned int Fl_Text_Buffer::char_at(int pos) const { if (pos < 0 || pos >= mLength) return '\0'; - IS_UTF8_ALIGNED(address(pos)) + IS_UTF8_ALIGNED2(this, (pos)) const char *src = address(pos); return fl_utf8decode(src, 0, 0); @@ -266,7 +266,7 @@ char Fl_Text_Buffer::byte_at(int pos) const { */ void Fl_Text_Buffer::insert(int pos, const char *text) { - IS_UTF8_ALIGNED(address(pos)) + IS_UTF8_ALIGNED2(this, (pos)) IS_UTF8_ALIGNED(text) /* check if there is actually any text */ @@ -285,7 +285,7 @@ void Fl_Text_Buffer::insert(int pos, const char *text) /* insert and redisplay */ int nInserted = insert_(pos, text); mCursorPosHint = pos + nInserted; - IS_UTF8_ALIGNED(address(mCursorPosHint)) + IS_UTF8_ALIGNED2(this, (mCursorPosHint)) call_modify_callbacks(pos, 0, nInserted, 0, NULL); } @@ -304,8 +304,8 @@ void Fl_Text_Buffer::replace(int start, int end, const char *text) if (end > mLength) end = mLength; - IS_UTF8_ALIGNED(address(start)) - IS_UTF8_ALIGNED(address(end)) + IS_UTF8_ALIGNED2(this, (start)) + IS_UTF8_ALIGNED2(this, (end)) IS_UTF8_ALIGNED(text) call_predelete_callbacks(start, end - start); @@ -339,8 +339,8 @@ void Fl_Text_Buffer::remove(int start, int end) if (end < 0) end = 0; - IS_UTF8_ALIGNED(address(start)) - IS_UTF8_ALIGNED(address(end)) + IS_UTF8_ALIGNED2(this, (start)) + IS_UTF8_ALIGNED2(this, (end)) if (start == end) return; @@ -362,9 +362,9 @@ void Fl_Text_Buffer::remove(int start, int end) void Fl_Text_Buffer::copy(Fl_Text_Buffer * fromBuf, int fromStart, int fromEnd, int toPos) { - IS_UTF8_ALIGNED(fromBuf->address(fromStart)) - IS_UTF8_ALIGNED(fromBuf->address(fromEnd)) - IS_UTF8_ALIGNED(address(toPos)) + IS_UTF8_ALIGNED2(fromBuf, fromStart) + IS_UTF8_ALIGNED2(fromBuf, fromEnd) + IS_UTF8_ALIGNED2(this, (toPos)) int copiedLength = fromEnd - fromStart; @@ -482,8 +482,8 @@ void Fl_Text_Buffer::tab_distance(int tabDist) */ void Fl_Text_Buffer::select(int start, int end) { - IS_UTF8_ALIGNED(address(start)) - IS_UTF8_ALIGNED(address(end)) + IS_UTF8_ALIGNED2(this, (start)) + IS_UTF8_ALIGNED2(this, (end)) Fl_Text_Selection oldSelection = mPrimary; @@ -861,8 +861,8 @@ int Fl_Text_Buffer::word_end(int pos) const { int Fl_Text_Buffer::count_displayed_characters(int lineStartPos, int targetPos) const { - IS_UTF8_ALIGNED(address(lineStartPos)) - IS_UTF8_ALIGNED(address(targetPos)) + IS_UTF8_ALIGNED2(this, (lineStartPos)) + IS_UTF8_ALIGNED2(this, (targetPos)) int charCount = 0; @@ -881,7 +881,7 @@ int Fl_Text_Buffer::count_displayed_characters(int lineStartPos, */ int Fl_Text_Buffer::skip_displayed_characters(int lineStartPos, int nChars) { - IS_UTF8_ALIGNED(address(lineStartPos)) + IS_UTF8_ALIGNED2(this, (lineStartPos)) int pos = lineStartPos; @@ -901,8 +901,8 @@ int Fl_Text_Buffer::skip_displayed_characters(int lineStartPos, int nChars) This function is optimized for speed by not using UTF-8 calls. */ int Fl_Text_Buffer::count_lines(int startPos, int endPos) const { - IS_UTF8_ALIGNED(address(startPos)) - IS_UTF8_ALIGNED(address(endPos)) + IS_UTF8_ALIGNED2(this, (startPos)) + IS_UTF8_ALIGNED2(this, (endPos)) int gapLen = mGapEnd - mGapStart; int lineCount = 0; @@ -932,7 +932,7 @@ int Fl_Text_Buffer::count_lines(int startPos, int endPos) const { */ int Fl_Text_Buffer::skip_lines(int startPos, int nLines) { - IS_UTF8_ALIGNED(address(startPos)) + IS_UTF8_ALIGNED2(this, (startPos)) if (nLines == 0) return startPos; @@ -944,7 +944,7 @@ int Fl_Text_Buffer::skip_lines(int startPos, int nLines) if (mBuf[pos++] == '\n') { lineCount++; if (lineCount == nLines) { - IS_UTF8_ALIGNED(address(pos)) + IS_UTF8_ALIGNED2(this, (pos)) return pos; } } @@ -953,12 +953,12 @@ int Fl_Text_Buffer::skip_lines(int startPos, int nLines) if (mBuf[pos++ + gapLen] == '\n') { lineCount++; if (lineCount >= nLines) { - IS_UTF8_ALIGNED(address(pos)) + IS_UTF8_ALIGNED2(this, (pos)) return pos; } } } - IS_UTF8_ALIGNED(address(pos)) + IS_UTF8_ALIGNED2(this, (pos)) return pos; } @@ -970,7 +970,7 @@ int Fl_Text_Buffer::skip_lines(int startPos, int nLines) */ int Fl_Text_Buffer::rewind_lines(int startPos, int nLines) { - IS_UTF8_ALIGNED(address(startPos)) + IS_UTF8_ALIGNED2(this, (startPos)) int pos = startPos - 1; if (pos <= 0) @@ -981,7 +981,7 @@ int Fl_Text_Buffer::rewind_lines(int startPos, int nLines) while (pos >= mGapStart) { if (mBuf[pos + gapLen] == '\n') { if (++lineCount >= nLines) { - IS_UTF8_ALIGNED(address(pos+1)) + IS_UTF8_ALIGNED2(this, (pos+1)) return pos + 1; } } @@ -990,7 +990,7 @@ int Fl_Text_Buffer::rewind_lines(int startPos, int nLines) while (pos >= 0) { if (mBuf[pos] == '\n') { if (++lineCount >= nLines) { - IS_UTF8_ALIGNED(address(pos+1)) + IS_UTF8_ALIGNED2(this, (pos+1)) return pos + 1; } } @@ -1006,7 +1006,7 @@ int Fl_Text_Buffer::rewind_lines(int startPos, int nLines) int Fl_Text_Buffer::search_forward(int startPos, const char *searchString, int *foundPos, int matchCase) const { - IS_UTF8_ALIGNED(address(startPos)) + IS_UTF8_ALIGNED2(this, (startPos)) IS_UTF8_ALIGNED(searchString) if (!searchString) @@ -1058,7 +1058,7 @@ int Fl_Text_Buffer::search_forward(int startPos, const char *searchString, int Fl_Text_Buffer::search_backward(int startPos, const char *searchString, int *foundPos, int matchCase) const { - IS_UTF8_ALIGNED(address(startPos)) + IS_UTF8_ALIGNED2(this, (startPos)) IS_UTF8_ALIGNED(searchString) if (!searchString) @@ -1568,7 +1568,7 @@ int Fl_Text_Buffer::prev_char_clipped(int pos) const if (pos<=0) return 0; - IS_UTF8_ALIGNED(address(pos)) + IS_UTF8_ALIGNED2(this, (pos)) char c; do { @@ -1578,7 +1578,7 @@ int Fl_Text_Buffer::prev_char_clipped(int pos) const c = byte_at(pos); } while ( (c&0xc0) == 0x80); - IS_UTF8_ALIGNED(address(pos)) + IS_UTF8_ALIGNED2(this, (pos)) return pos; } @@ -1600,12 +1600,12 @@ int Fl_Text_Buffer::prev_char(int pos) const */ int Fl_Text_Buffer::next_char(int pos) const { - IS_UTF8_ALIGNED(address(pos)) + IS_UTF8_ALIGNED2(this, (pos)) int n = fl_utf8len(byte_at(pos)); pos += n; if (pos>=mLength) return mLength; - IS_UTF8_ALIGNED(address(pos)) + IS_UTF8_ALIGNED2(this, (pos)) return pos; } diff --git a/src/Fl_Text_Display.cxx b/src/Fl_Text_Display.cxx index 48f726f69..63d59a6af 100644 --- a/src/Fl_Text_Display.cxx +++ b/src/Fl_Text_Display.cxx @@ -483,8 +483,8 @@ void Fl_Text_Display::draw_text( int left, int top, int width, int height ) { \param endpos index after last character needing redraw */ void Fl_Text_Display::redisplay_range(int startpos, int endpos) { - IS_UTF8_ALIGNED(buffer()->address(startpos)) - IS_UTF8_ALIGNED(buffer()->address(endpos)) + IS_UTF8_ALIGNED2(buffer(), startpos) + IS_UTF8_ALIGNED2(buffer(), endpos) if (damage_range1_start == -1 && damage_range1_end == -1) { damage_range1_start = startpos; @@ -584,7 +584,7 @@ void Fl_Text_Display::draw_range(int startpos, int endpos) { \param newPos new caret position */ void Fl_Text_Display::insert_position( int newPos ) { - IS_UTF8_ALIGNED(buffer()->address(newPos)) + IS_UTF8_ALIGNED2(buffer(), newPos) /* make sure new position is ok, do nothing if it hasn't changed */ if ( newPos == mCursorPos ) return; @@ -696,7 +696,7 @@ void Fl_Text_Display::wrap_mode(int wrap, int wrapMargin) { \param text new text in UTF-8 encoding. */ void Fl_Text_Display::insert(const char* text) { - IS_UTF8_ALIGNED(buffer()->address(mCursorPos)) + IS_UTF8_ALIGNED2(buffer(), mCursorPos) IS_UTF8_ALIGNED(text) int pos = mCursorPos; @@ -715,7 +715,7 @@ void Fl_Text_Display::insert(const char* text) { \todo Unicode? Find out exactly what we do here and simplify. */ void Fl_Text_Display::overstrike(const char* text) { - IS_UTF8_ALIGNED(buffer()->address(mCursorPos)) + IS_UTF8_ALIGNED2(buffer(), mCursorPos) IS_UTF8_ALIGNED(text) int startPos = mCursorPos; @@ -784,7 +784,7 @@ void Fl_Text_Display::overstrike(const char* text) { \return 0 if charater vertically out of view, X position otherwise */ int Fl_Text_Display::position_to_xy( int pos, int* X, int* Y ) const { - IS_UTF8_ALIGNED(buffer()->address(pos)) + IS_UTF8_ALIGNED2(buffer(), pos) int lineStartPos, fontHeight, lineLen; int visLineNum; @@ -838,7 +838,7 @@ int Fl_Text_Display::position_to_xy( int pos, int* X, int* Y ) const { Please check teh functions that call this particular function. */ int Fl_Text_Display::position_to_linecol( int pos, int* lineNum, int* column ) const { - IS_UTF8_ALIGNED(buffer()->address(pos)) + IS_UTF8_ALIGNED2(buffer(), pos) int retVal; @@ -870,7 +870,7 @@ int Fl_Text_Display::position_to_linecol( int pos, int* lineNum, int* column ) c */ int Fl_Text_Display::in_selection( int X, int Y ) const { int pos = xy_to_position( X, Y, CHARACTER_POS ); - IS_UTF8_ALIGNED(buffer()->address(pos)) + IS_UTF8_ALIGNED2(buffer(), pos) Fl_Text_Buffer *buf = mBuffer; return buf->primary_selection()->includes(pos); } @@ -1122,8 +1122,8 @@ int Fl_Text_Display::move_down() { */ int Fl_Text_Display::count_lines(int startPos, int endPos, bool startPosIsLineStart) const { - IS_UTF8_ALIGNED(buffer()->address(startPos)) - IS_UTF8_ALIGNED(buffer()->address(endPos)) + IS_UTF8_ALIGNED2(buffer(), startPos) + IS_UTF8_ALIGNED2(buffer(), endPos) int retLines, retPos, retLineStart, retLineEnd; @@ -1165,7 +1165,7 @@ int Fl_Text_Display::count_lines(int startPos, int endPos, */ int Fl_Text_Display::skip_lines(int startPos, int nLines, bool startPosIsLineStart) { - IS_UTF8_ALIGNED(buffer()->address(startPos)) + IS_UTF8_ALIGNED2(buffer(), startPos) int retLines, retPos, retLineStart, retLineEnd; @@ -1181,7 +1181,7 @@ int Fl_Text_Display::skip_lines(int startPos, int nLines, wrapped_line_counter(buffer(), startPos, buffer()->length(), nLines, startPosIsLineStart, 0, &retPos, &retLines, &retLineStart, &retLineEnd); - IS_UTF8_ALIGNED(buffer()->address(retPos)) + IS_UTF8_ALIGNED2(buffer(), retPos) return retPos; } @@ -1210,7 +1210,7 @@ int Fl_Text_Display::skip_lines(int startPos, int nLines, \retun new position as index */ int Fl_Text_Display::line_end(int pos, bool startPosIsLineStart) const { - IS_UTF8_ALIGNED(buffer()->address(pos)) + IS_UTF8_ALIGNED2(buffer(), pos) int retLines, retPos, retLineStart, retLineEnd; @@ -1225,7 +1225,7 @@ int Fl_Text_Display::line_end(int pos, bool startPosIsLineStart) const { startPosIsLineStart, 0, &retPos, &retLines, &retLineStart, &retLineEnd); - IS_UTF8_ALIGNED(buffer()->address(retLineEnd)) + IS_UTF8_ALIGNED2(buffer(), retLineEnd) return retLineEnd; } @@ -1241,7 +1241,7 @@ int Fl_Text_Display::line_end(int pos, bool startPosIsLineStart) const { \return new position as index */ int Fl_Text_Display::line_start(int pos) const { - IS_UTF8_ALIGNED(buffer()->address(pos)) + IS_UTF8_ALIGNED2(buffer(), pos) int retLines, retPos, retLineStart, retLineEnd; @@ -1252,7 +1252,7 @@ int Fl_Text_Display::line_start(int pos) const { wrapped_line_counter(buffer(), buffer()->line_start(pos), pos, INT_MAX, true, 0, &retPos, &retLines, &retLineStart, &retLineEnd); - IS_UTF8_ALIGNED(buffer()->address(retLineStart)) + IS_UTF8_ALIGNED2(buffer(), retLineStart) return retLineStart; } @@ -1269,7 +1269,7 @@ int Fl_Text_Display::line_start(int pos) const { \return new position as index */ int Fl_Text_Display::rewind_lines(int startPos, int nLines) { - IS_UTF8_ALIGNED(buffer()->address(startPos)) + IS_UTF8_ALIGNED2(buffer(), startPos) Fl_Text_Buffer *buf = buffer(); int pos, lineStart, retLines, retPos, retLineStart, retLineEnd; @@ -1367,7 +1367,7 @@ void Fl_Text_Display::buffer_predelete_cb(int pos, int nDeleted, void *cbArg) { kind of calculations in advance, even if the font width is "fixed", because when the width of the tab characters changes, the layout of the text may be completely different. */ - IS_UTF8_ALIGNED(textD->buffer()->address(pos)) + IS_UTF8_ALIGNED2(textD->buffer(), pos) textD->measure_deleted_lines(pos, nDeleted); } else { textD->mSuppressResync = 0; /* Probably not needed, but just in case */ @@ -1397,9 +1397,9 @@ void Fl_Text_Display::buffer_modified_cb( int pos, int nInserted, int nDeleted, int scrolled, origCursorPos = textD->mCursorPos; int wrapModStart, wrapModEnd; - IS_UTF8_ALIGNED(buf->address(pos)) - IS_UTF8_ALIGNED(buf->address(oldFirstChar)) - IS_UTF8_ALIGNED(buf->address(origCursorPos)) + IS_UTF8_ALIGNED2(buf, pos) + IS_UTF8_ALIGNED2(buf, oldFirstChar) + IS_UTF8_ALIGNED2(buf, origCursorPos) /* buffer modification cancels vertical cursor motion column */ if ( nInserted != 0 || nDeleted != 0 ) @@ -1473,11 +1473,11 @@ void Fl_Text_Display::buffer_modified_cb( int pos, int nInserted, int nDeleted, old cursor gets erased, and erase the bits of the cursor which extend beyond the left and right edges of the text. */ startDispPos = textD->mContinuousWrap ? wrapModStart : pos; - IS_UTF8_ALIGNED(buf->address(startDispPos)) + IS_UTF8_ALIGNED2(buf, startDispPos) if ( origCursorPos == startDispPos && textD->mCursorPos != startDispPos ) startDispPos = min( startDispPos, buf->prev_char_clipped(origCursorPos) ); - IS_UTF8_ALIGNED(buf->address(startDispPos)) + IS_UTF8_ALIGNED2(buf, startDispPos) if ( linesInserted == linesDeleted ) { if ( nInserted == 0 && nDeleted == 0 ) @@ -1503,8 +1503,8 @@ void Fl_Text_Display::buffer_modified_cb( int pos, int nInserted, int nDeleted, results in at least two lines being redrawn). */ textD->draw_line_numbers(false); } - IS_UTF8_ALIGNED(buf->address(startDispPos)) - IS_UTF8_ALIGNED(buf->address(endDispPos)) + IS_UTF8_ALIGNED2(buf, startDispPos) + IS_UTF8_ALIGNED2(buf, endDispPos) /* If there is a style buffer, check if the modification caused additional changes that need to be redisplayed. (Redisplaying separately would @@ -1512,8 +1512,8 @@ void Fl_Text_Display::buffer_modified_cb( int pos, int nInserted, int nDeleted, text). Extend the redraw range to incorporate style changes */ if ( textD->mStyleBuffer ) textD->extend_range_for_styles( &startDispPos, &endDispPos ); - IS_UTF8_ALIGNED(buf->address(startDispPos)) - IS_UTF8_ALIGNED(buf->address(endDispPos)) + IS_UTF8_ALIGNED2(buf, startDispPos) + IS_UTF8_ALIGNED2(buf, endDispPos) /* Redisplay computed range */ textD->redisplay_range( startDispPos, endDispPos ); @@ -1611,7 +1611,7 @@ void Fl_Text_Display::reset_absolute_top_line_number() { \todo What does this do? */ int Fl_Text_Display::position_to_line( int pos, int *lineNum ) const { - IS_UTF8_ALIGNED(buffer()->address(pos)) + IS_UTF8_ALIGNED2(buffer(), pos) int i; @@ -1670,7 +1670,7 @@ int Fl_Text_Display::handle_vline( int Y, int bottomClip, int leftClip, int rightClip) const { - IS_UTF8_ALIGNED(buffer()->address(lineStartPos)) + IS_UTF8_ALIGNED2(buffer(), lineStartPos) // FIXME: we need to allow two modes for FIND_INDEX: one on the edge of the // FIXME: character for selection, and one on the character center for cursors. @@ -1697,7 +1697,7 @@ int Fl_Text_Display::handle_vline( draw_string( style|BG_ONLY_MASK, text_area.x, Y, text_area.x+text_area.w, lineStr, lineLen ); } if (mode==FIND_INDEX) { - IS_UTF8_ALIGNED(buffer()->address(lineStartPos)) + IS_UTF8_ALIGNED2(buffer(), lineStartPos) return lineStartPos; } return 0; @@ -1719,7 +1719,7 @@ int Fl_Text_Display::handle_vline( // find x pos inside block int di = find_x(lineStr+startIndex, i-startIndex, style, rightClip-startX); free(lineStr); - IS_UTF8_ALIGNED(buffer()->address(lineStartPos+startIndex+di)) + IS_UTF8_ALIGNED2(buffer(), (lineStartPos+startIndex+di)) return lineStartPos + startIndex + di; } style = charStyle; @@ -1739,7 +1739,7 @@ int Fl_Text_Display::handle_vline( // find x pos inside block int di = find_x(lineStr+startIndex, i-startIndex, style, rightClip-startX); free(lineStr); - IS_UTF8_ALIGNED(buffer()->address(lineStartPos+startIndex+di)) + IS_UTF8_ALIGNED2(buffer(), (lineStartPos+startIndex+di)) return lineStartPos + startIndex + di; } if (mode==GET_WIDTH) { @@ -1754,7 +1754,7 @@ int Fl_Text_Display::handle_vline( draw_string( style|BG_ONLY_MASK, startX, Y, text_area.x+text_area.w, lineStr, lineLen ); free(lineStr); - IS_UTF8_ALIGNED(buffer()->address(lineStartPos+lineLen)) + IS_UTF8_ALIGNED2(buffer(), (lineStartPos+lineLen)) return lineStartPos + lineLen; } @@ -2064,7 +2064,7 @@ void Fl_Text_Display::draw_cursor( int X, int Y ) { */ int Fl_Text_Display::position_style( int lineStartPos, int lineLen, int lineIndex) const { - IS_UTF8_ALIGNED(buffer()->address(lineStartPos)) + IS_UTF8_ALIGNED2(buffer(), lineStartPos) Fl_Text_Buffer * buf = mBuffer; Fl_Text_Buffer *styleBuf = mStyleBuffer; @@ -2284,7 +2284,7 @@ void Fl_Text_Display::offset_line_starts( int newTopLineNum ) { void Fl_Text_Display::update_line_starts(int pos, int charsInserted, int charsDeleted, int linesInserted, int linesDeleted, int *scrolled ) { - IS_UTF8_ALIGNED(buffer()->address(pos)) + IS_UTF8_ALIGNED2(buffer(), pos) int *lineStarts = mLineStarts; int i, lineOfPos, lineOfEnd, nVisLines = mNVisibleLines; @@ -2730,7 +2730,7 @@ void Fl_Text_Display::find_wrap_range(const char *deletedText, int pos, int *modRangeStart, int *modRangeEnd, int *linesInserted, int *linesDeleted) { IS_UTF8_ALIGNED(deletedText) - IS_UTF8_ALIGNED(buffer()->address(pos)) + IS_UTF8_ALIGNED2(buffer(), pos) int length, retPos, retLines, retLineStart, retLineEnd; Fl_Text_Buffer *deletedTextBuf, *buf = buffer(); @@ -2760,7 +2760,7 @@ void Fl_Text_Display::find_wrap_range(const char *deletedText, int pos, countFrom = buf->line_start(pos); } - IS_UTF8_ALIGNED(buffer()->address(countFrom)) + IS_UTF8_ALIGNED2(buffer(), countFrom) /* ** Move forward through the (new) text one line at a time, counting @@ -2894,7 +2894,7 @@ void Fl_Text_Display::find_wrap_range(const char *deletedText, int pos, \param nDeleted */ void Fl_Text_Display::measure_deleted_lines(int pos, int nDeleted) { - IS_UTF8_ALIGNED(buffer()->address(pos)) + IS_UTF8_ALIGNED2(buffer(), pos) int retPos, retLines, retLineStart, retLineEnd; Fl_Text_Buffer *buf = buffer(); @@ -2989,8 +2989,8 @@ void Fl_Text_Display::wrapped_line_counter(Fl_Text_Buffer *buf, int startPos, int maxPos, int maxLines, bool startPosIsLineStart, int styleBufOffset, int *retPos, int *retLines, int *retLineStart, int *retLineEnd, bool countLastLineMissingNewLine) const { - IS_UTF8_ALIGNED(buf->address(startPos)) - if (maxPos<buf->length()) IS_UTF8_ALIGNED(buf->address(maxPos)) + IS_UTF8_ALIGNED2(buf, startPos) + IS_UTF8_ALIGNED2(buf, maxPos) int lineStart, newLineStart = 0, b, p, colNum, wrapMargin; int maxWidth, i, foundBreak, width; @@ -3175,7 +3175,7 @@ int Fl_Text_Display::measure_proportional_character(const char *s, int colNum, i */ void Fl_Text_Display::find_line_end(int startPos, bool startPosIsLineStart, int *lineEnd, int *nextLineStart) const { - IS_UTF8_ALIGNED(buffer()->address(startPos)) + IS_UTF8_ALIGNED2(buffer(), startPos) int retLines, retLineStart; @@ -3218,7 +3218,7 @@ void Fl_Text_Display::find_line_end(int startPos, bool startPosIsLineStart, \return 1 if a \\n character causes the line wrap */ int Fl_Text_Display::wrap_uses_character(int lineEndPos) const { - IS_UTF8_ALIGNED(buffer()->address(lineEndPos)) + IS_UTF8_ALIGNED2(buffer(), lineEndPos) unsigned int c; @@ -3245,8 +3245,8 @@ int Fl_Text_Display::wrap_uses_character(int lineEndPos) const { \todo Unicode? */ void Fl_Text_Display::extend_range_for_styles( int *startpos, int *endpos ) { - IS_UTF8_ALIGNED(buffer()->address(*startpos)) - IS_UTF8_ALIGNED(buffer()->address(*endpos)) + IS_UTF8_ALIGNED2(buffer(), (*startpos)) + IS_UTF8_ALIGNED2(buffer(), (*endpos)) Fl_Text_Selection * sel = mStyleBuffer->primary_selection(); int extended = 0; @@ -3266,13 +3266,13 @@ void Fl_Text_Display::extend_range_for_styles( int *startpos, int *endpos ) { *startpos = sel->start(); // FIXME: somewhere while deleting, alignment is lost! *startpos = buffer()->utf8_align(*startpos); - IS_UTF8_ALIGNED(buffer()->address(*startpos)) + IS_UTF8_ALIGNED2(buffer(), (*startpos)) extended = 1; } if ( sel->end() > *endpos ) { *endpos = sel->end(); *endpos = buffer()->utf8_align(*endpos); - IS_UTF8_ALIGNED(buffer()->address(*endpos)) + IS_UTF8_ALIGNED2(buffer(), (*endpos)) extended = 1; } } @@ -3283,7 +3283,7 @@ void Fl_Text_Display::extend_range_for_styles( int *startpos, int *endpos ) { if ( extended ) *endpos = mBuffer->line_end( *endpos ) + 1; - IS_UTF8_ALIGNED(buffer()->address(*endpos)) + IS_UTF8_ALIGNED2(buffer(), (*endpos)) } diff --git a/src/fl_utf8.cxx b/src/fl_utf8.cxx index 6d69a588e..1cd809eed 100644 --- a/src/fl_utf8.cxx +++ b/src/fl_utf8.cxx @@ -378,11 +378,11 @@ int fl_latin12utf(const unsigned char *str, int len, char *buf) */ unsigned int fl_nonspacing(unsigned int ucs) { -//#ifdef __APPLE__ -// return (ucs==0x20); // FIXME: what does this really do? -//#else +#ifdef __APPLE__ + return (ucs==0x20); // FIXME: what does this really do? +#else return (unsigned int) XUtf8IsNonSpacing(ucs); -//#endif +#endif } #if defined(WIN32) && !defined(__CYGWIN__) |
