diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/3rdparty/libmng/aclocal.m4 | 15 | ||||
-rwxr-xr-x | src/3rdparty/libmng/config.guess | 16 | ||||
-rwxr-xr-x | src/3rdparty/libmng/config.sub | 8 | ||||
-rwxr-xr-x | src/3rdparty/libmng/configure | 15 | ||||
-rw-r--r-- | src/kernel/tqfont_x11.cpp | 32 | ||||
-rw-r--r-- | src/kernel/tqfontengine_p.h | 2 | ||||
-rw-r--r-- | src/kernel/tqfontengine_x11.cpp | 58 | ||||
-rw-r--r-- | src/kernel/tqfontmetrics.h | 2 | ||||
-rw-r--r-- | src/kernel/tqrichtext.cpp | 33 | ||||
-rw-r--r-- | src/kernel/tqrichtext_p.cpp | 12 | ||||
-rw-r--r-- | src/kernel/tqscriptengine.cpp | 21 | ||||
-rw-r--r-- | src/kernel/tqtextengine.cpp | 107 | ||||
-rw-r--r-- | src/tools/tqglobal.h | 3 | ||||
-rw-r--r-- | src/widgets/tqlineedit.cpp | 14 | ||||
-rw-r--r-- | src/widgets/tqtextedit.cpp | 16 |
15 files changed, 177 insertions, 177 deletions
diff --git a/src/3rdparty/libmng/aclocal.m4 b/src/3rdparty/libmng/aclocal.m4 index 4283bf097..f7667191b 100644 --- a/src/3rdparty/libmng/aclocal.m4 +++ b/src/3rdparty/libmng/aclocal.m4 @@ -2024,12 +2024,6 @@ EOF hardcode_shlibpath_var=no ;; - dgux*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_shlibpath_var=no - ;; - sysv4*MP*) if test -d /usr/nec; then archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' @@ -2462,15 +2456,6 @@ uts4*) shlibpath_var=LD_LIBRARY_PATH ;; -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - sysv4*MP*) if test -d /usr/nec ;then version_type=linux diff --git a/src/3rdparty/libmng/config.guess b/src/3rdparty/libmng/config.guess index f75adf068..44b51774b 100755 --- a/src/3rdparty/libmng/config.guess +++ b/src/3rdparty/libmng/config.guess @@ -367,22 +367,6 @@ EOF m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit 0 ;; - AViiON:dgux:*:*) - # DG/UX returns AViiON for all architectures - UNAME_PROCESSOR=`/usr/bin/uname -p` - if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] - then - if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ - [ ${TARGET_BINARY_INTERFACE}x = x ] - then - echo m88k-dg-dgux${UNAME_RELEASE} - else - echo m88k-dg-dguxbcs${UNAME_RELEASE} - fi - else - echo i586-dg-dgux${UNAME_RELEASE} - fi - exit 0 ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit 0 ;; diff --git a/src/3rdparty/libmng/config.sub b/src/3rdparty/libmng/config.sub index 4d87ba463..20a53902e 100755 --- a/src/3rdparty/libmng/config.sub +++ b/src/3rdparty/libmng/config.sub @@ -1025,7 +1025,7 @@ case $os in # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ - | -hpux* | -unos* | -luna* | -dgux* | -solaris* | -sym* \ + | -hpux* | -unos* | -luna* | -solaris* | -sym* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ @@ -1222,9 +1222,6 @@ case $basic_machine in *-cbm) os=-amigaos ;; - *-dg) - os=-dgux - ;; *-dolphin) os=-sysv3 ;; @@ -1321,9 +1318,6 @@ case $basic_machine in -unos*) vendor=crds ;; - -dgux*) - vendor=dg - ;; -luna*) vendor=omron ;; diff --git a/src/3rdparty/libmng/configure b/src/3rdparty/libmng/configure index 8bd536d25..162ef6a1d 100755 --- a/src/3rdparty/libmng/configure +++ b/src/3rdparty/libmng/configure @@ -3802,12 +3802,6 @@ EOF hardcode_shlibpath_var=no ;; - dgux*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_shlibpath_var=no - ;; - sysv4*MP*) if test -d /usr/nec; then archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' @@ -4243,15 +4237,6 @@ uts4*) shlibpath_var=LD_LIBRARY_PATH ;; -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - sysv4*MP*) if test -d /usr/nec ;then version_type=linux diff --git a/src/kernel/tqfont_x11.cpp b/src/kernel/tqfont_x11.cpp index 6f4097029..92cd8b113 100644 --- a/src/kernel/tqfont_x11.cpp +++ b/src/kernel/tqfont_x11.cpp @@ -675,22 +675,32 @@ int TQFontMetrics::width( TQChar ch ) const return advances[0]; } - int TQFontMetrics::charWidth( const TQString &str, int pos ) const { - if ( pos < 0 || pos > (int)str.length() ) + if ( pos < 0 || pos >= (int)str.length() ) return 0; - const TQChar &ch = str.unicode()[ pos ]; - if ( ch.unicode() < TQFontEngineData::widthCacheSize && - d->engineData && d->engineData->widthCache[ ch.unicode() ] ) - return d->engineData->widthCache[ ch.unicode() ]; + uint uc; + bool isSurrogate; + if (str[pos].isHighSurrogate() && pos < (str.length() - 1) && str[pos + 1].isLowSurrogate()) + { + isSurrogate = true; + uc = TQChar::surrogateToUcs4(str[pos], str[pos + 1]); + } + else + { + isSurrogate = false; + uc = str[pos].unicode(); + } + if ( uc < TQFontEngineData::widthCacheSize && + d->engineData && d->engineData->widthCache[ uc ] ) + return d->engineData->widthCache[ uc ]; + const TQChar &ch = str.unicode()[ pos ]; TQFont::Script script; SCRIPT_FOR_CHAR( script, ch ); int width; - if ( script >= TQFont::Arabic && script <= TQFont::Khmer ) { // complex script shaping. Have to do some hard work int from = TQMAX( 0, pos - 8 ); @@ -700,7 +710,7 @@ int TQFontMetrics::charWidth( const TQString &str, int pos ) const layout.itemize( TQTextEngine::WidthOnly ); width = layout.width( pos-from, 1 ); } else if ( ::category( ch ) == TQChar::Mark_NonSpacing || qIsZeroWidthChar(ch.unicode())) { - width = 0; + width = 0; } else { TQFontEngine *engine = d->engineForScript( script ); #ifdef QT_CHECK_STATE @@ -710,10 +720,10 @@ int TQFontMetrics::charWidth( const TQString &str, int pos ) const glyph_t glyphs[8]; advance_t advances[8]; int nglyphs = 7; - engine->stringToCMap( &ch, 1, glyphs, advances, &nglyphs, FALSE ); + engine->stringToCMap( &ch, isSurrogate ? 2 : 1, glyphs, advances, &nglyphs, FALSE ); width = advances[0]; } - if ( ch.unicode() < TQFontEngineData::widthCacheSize && width > 0 && width < 0x100 ) - d->engineData->widthCache[ ch.unicode() ] = width; + if ( uc < TQFontEngineData::widthCacheSize && width > 0 && width < 0x100 ) + d->engineData->widthCache[ uc ] = width; return width; } diff --git a/src/kernel/tqfontengine_p.h b/src/kernel/tqfontengine_p.h index fe8714ef3..86fdda8f0 100644 --- a/src/kernel/tqfontengine_p.h +++ b/src/kernel/tqfontengine_p.h @@ -284,7 +284,7 @@ public: FT_Face face() const { return _face; } XftFont *font() const { return _font; } - void recalcAdvances( int len, glyph_t *glyphs, advance_t *advances ); + void recalcAdvances( int len, glyph_t *glyphs, advance_t *advances ) const; private: friend class TQFontPrivate; diff --git a/src/kernel/tqfontengine_x11.cpp b/src/kernel/tqfontengine_x11.cpp index 47078dea9..aa116b93d 100644 --- a/src/kernel/tqfontengine_x11.cpp +++ b/src/kernel/tqfontengine_x11.cpp @@ -1531,12 +1531,11 @@ static glyph_t getAdobeCharIndex(XftFont *font, int cmap, uint ucs4) return g; } -static uint getUnicode(const TQChar *str, int &i, const int len) +static uint getCodepoint(const TQChar *str, int &i, const int len) { if (str[i].isHighSurrogate() && i < (len - 1) && str[i + 1].isLowSurrogate()) { - ++i; // Don't delete this: it is required for correct - // advancement when handling surrogate pairs + ++i; // This is required for correct advancement when handling surrogate pairs return TQChar::surrogateToUcs4(str[i - 1], str[i]); } return str[i].unicode(); @@ -1551,7 +1550,7 @@ TQFontEngine::Error TQFontEngineXft::stringToCMap( const TQChar *str, int len, g int glyph_pos = 0; for ( int i = 0; i < len; ++i ) { - uint uc = getUnicode(str, i, len); + uint uc = getCodepoint(str, i, len); if ( uc == 0xa0 ) uc = 0x20; if ( mirrored ) @@ -1575,32 +1574,17 @@ TQFontEngine::Error TQFontEngineXft::stringToCMap( const TQChar *str, int len, g ++glyph_pos; } - if ( advances ) { - for ( int i = 0; i < glyph_pos; i++ ) { - glyph_t glyph = *(glyphs + i); - advances[i] = (glyph < widthCacheSize) ? widthCache[glyph] : 0; - if ( !advances[i] ) { - XGlyphInfo gi; - XftGlyphExtents( TQPaintDevice::x11AppDisplay(), _font, &glyph, 1, &gi ); - advances[i] = gi.xOff; - if ( glyph < widthCacheSize && gi.xOff > 0 && gi.xOff < 0x100 ) - ((TQFontEngineXft *)this)->widthCache[glyph] = gi.xOff; - } - } - if ( _scale != 1. ) { - for ( int i = 0; i < len; i++ ) - advances[i] = tqRound(advances[i]*_scale); - } + if ( advances ) + { + recalcAdvances(glyph_pos, glyphs, advances); } *nglyphs = glyph_pos; return NoError; } - -void TQFontEngineXft::recalcAdvances( int len, glyph_t *glyphs, advance_t *advances ) +void TQFontEngineXft::recalcAdvances( int len, glyph_t *glyphs, advance_t *advances ) const { - for ( int i = 0; i < len; i++ ) { FT_UInt glyph = *(glyphs + i); advances[i] = (glyph < widthCacheSize) ? widthCache[glyph] : 0; @@ -1999,20 +1983,22 @@ bool TQFontEngineXft::canRender( const TQChar *string, int len ) bool allExist = TRUE; if (_cmap != -1) { - for ( int i = 0; i < len; i++ ) { - if (!XftCharExists(0, _font, string[i].unicode()) - && getAdobeCharIndex(_font, _cmap, string[i].unicode()) == 0) { - allExist = FALSE; - break; - } - } + for ( int i = 0; i < len; i++ ) { + uint uc = getCodepoint(string, i, len); + if (!XftCharExists(0, _font, uc) + && getAdobeCharIndex(_font, _cmap, uc) == 0) { + allExist = FALSE; + break; + } + } } else { - for ( int i = 0; i < len; i++ ) { - if (!XftCharExists(0, _font, string[i].unicode())) { - allExist = FALSE; - break; - } - } + for ( int i = 0; i < len; i++ ) { + uint uc = getCodepoint(string, i, len); + if (!XftCharExists(0, _font, uc)) { + allExist = FALSE; + break; + } + } } return allExist; diff --git a/src/kernel/tqfontmetrics.h b/src/kernel/tqfontmetrics.h index b635a864e..35d09f5e8 100644 --- a/src/kernel/tqfontmetrics.h +++ b/src/kernel/tqfontmetrics.h @@ -79,7 +79,7 @@ public: int width( char c ) const { return width( (TQChar) c ); } #endif - int charWidth( const TQString &str, int pos ) const; + int charWidth( const TQString &str, int pos ) const; TQRect boundingRect( const TQString &, int len = -1 ) const; TQRect boundingRect( TQChar ) const; TQRect boundingRect( int x, int y, int w, int h, int flags, diff --git a/src/kernel/tqrichtext.cpp b/src/kernel/tqrichtext.cpp index 3585e470d..98fbc8f53 100644 --- a/src/kernel/tqrichtext.cpp +++ b/src/kernel/tqrichtext.cpp @@ -219,12 +219,19 @@ TQTextCursor *TQTextDeleteCommand::execute( TQTextCursor *c ) cursor.setParagraph( s ); cursor.setIndex( index ); int len = text.size(); + if ( c ) *c = cursor; if ( doc ) { doc->setSelectionStart( TQTextDocument::Temp, cursor ); for ( int i = 0; i < len; ++i ) + { + if (text[i].c.isHighSurrogate() && i < (len - 1) && text[i + 1].c.isLowSurrogate()) + { + ++i; // This is required for correct advancement when handling surrogate pairs + } cursor.gotoNextLetter(); + } doc->setSelectionEnd( TQTextDocument::Temp, cursor ); doc->removeSelectedText( TQTextDocument::Temp, &cursor ); if ( c ) @@ -1248,9 +1255,17 @@ bool TQTextCursor::removePreviousChar() { tmpX = -1; if ( !atParagStart() ) { - para->remove( idx-1, 1 ); + if (para->at(idx - 1)->c.isLowSurrogate() && idx > 1 && para->at(idx - 2)->c.isHighSurrogate()) + { + para->remove(idx - 2, 2); + idx -= 2; + } + else + { + para->remove(idx - 1, 1); + idx--; + } int h = para->rect().height(); - idx--; // shouldn't be needed, just to make sure. fixCursorPosition(); para->format( -1, TRUE ); @@ -4007,6 +4022,7 @@ int TQTextString::width( int idx ) const { int w = 0; TQTextStringChar *c = &at( idx ); + // '!c->charStop' already takes care of low surrogate chars if ( !c->charStop || c->c.unicode() == 0xad || c->c.unicode() == 0x2028 ) return 0; #ifndef TQT_NO_TEXTCUSTOMITEM @@ -4290,10 +4306,10 @@ void TQTextParagraph::format( int start, bool doMove ) if ( !str || str->length() == 0 || !formatter() ) return; - if ( hasdoc && - document()->preProcessor() && - ( needPreProcess || state == -1 ) ) + if ( hasdoc && document()->preProcessor() && ( needPreProcess || state == -1 ) ) + { document()->preProcessor()->process( document(), this, invalid <= 0 ? 0 : invalid ); + } needPreProcess = FALSE; if ( invalid == -1 ) @@ -5782,6 +5798,7 @@ int TQTextFormatterBreakWords::format( TQTextDocument *doc, TQTextParagraph *par lastChr = c->c; lastFormat = c->format(); } + bool lastWasOwnLineCustomItem = lastBreak == -2; bool hadBreakableChar = lastBreak != -1; bool lastWasHardBreak = lastChr == TQChar_linesep; @@ -5791,6 +5808,12 @@ int TQTextFormatterBreakWords::format( TQTextDocument *doc, TQTextParagraph *par c->format()->setPainter( painter ); c = &string->at( i ); + // Skip over low surrogate chars + if (c->c.isLowSurrogate()) + { + continue; + } + if (lastFormat != c->format() && !c->c.isSpace() && lastFormat->font().italic() && !c->format()->font().italic()) { int rb = lastFormat->fontMetrics().rightBearing(lastChr); diff --git a/src/kernel/tqrichtext_p.cpp b/src/kernel/tqrichtext_p.cpp index e9417d2a9..165d319db 100644 --- a/src/kernel/tqrichtext_p.cpp +++ b/src/kernel/tqrichtext_p.cpp @@ -114,15 +114,15 @@ int TQTextCursor::x() const return 0; TQTextStringChar *c = para->at( idx ); int curx = c->x; - if ( !c->rightToLeft && - c->c.isSpace() && - idx > 0 && - para->at( idx - 1 )->c != '\t' && - !c->lineStart && - ( para->alignment() & TQt::AlignJustify ) == TQt::AlignJustify ) + if ( !c->rightToLeft && c->c.isSpace() && idx > 0 && para->at( idx - 1 )->c != '\t' && + !c->lineStart && ( para->alignment() & TQt::AlignJustify ) == TQt::AlignJustify ) + { curx = para->at( idx - 1 )->x + para->string()->width( idx - 1 ); + } if ( c->rightToLeft ) + { curx += para->string()->width( idx ); + } return curx; } diff --git a/src/kernel/tqscriptengine.cpp b/src/kernel/tqscriptengine.cpp index 588596716..36df1fa77 100644 --- a/src/kernel/tqscriptengine.cpp +++ b/src/kernel/tqscriptengine.cpp @@ -288,10 +288,21 @@ static void heuristicSetGlyphAttributes(TQShaperItem *item, const TQChar *uc, in Q_ASSERT(item->num_glyphs <= length); unsigned short *logClusters = item->log_clusters; - - int i; - for (i = 0; i < length; ++i) - logClusters[i] = i; + int glyph_pos = 0; + for (int i = 0; i < length; i++) + { + if (uc[i].isHighSurrogate() && i < (length - 1) && uc[i+1].isLowSurrogate()) + { + logClusters[i] = glyph_pos; + logClusters[++i] = glyph_pos; + } + else + { + logClusters[i] = glyph_pos; + } + ++glyph_pos; + } + Q_ASSERT(glyph_pos == item->num_glyphs); // first char in a run is never (treated as) a mark int cStart = 0; @@ -307,7 +318,7 @@ static void heuristicSetGlyphAttributes(TQShaperItem *item, const TQChar *uc, in } int lastCat = ::category(uc[0]); - for (i = 1; i < length; ++i) { + for (int i = 1; i < length; ++i) { int cat = ::category(uc[i]); if (qIsZeroWidthChar(uc[i].unicode())) { item->attributes[i].mark = FALSE; diff --git a/src/kernel/tqtextengine.cpp b/src/kernel/tqtextengine.cpp index 05cdbcc13..067a21740 100644 --- a/src/kernel/tqtextengine.cpp +++ b/src/kernel/tqtextengine.cpp @@ -800,72 +800,77 @@ static void calcLineBreaks(const TQString &str, TQCharAttributes *charAttributes { int len = str.length(); if (!len) - return; + return; const TQChar *uc = str.unicode(); int cls = lineBreakClass(*uc); if (cls >= TQUnicodeTables::LineBreak_CM) - cls = TQUnicodeTables::LineBreak_ID; + cls = TQUnicodeTables::LineBreak_ID; charAttributes[0].softBreak = FALSE; charAttributes[0].whiteSpace = (cls == TQUnicodeTables::LineBreak_SP); charAttributes[0].charStop = TRUE; - for (int i = 1; i < len; ++i) { - int ncls = ::lineBreakClass(uc[i]); - int category = ::category(uc[i]); - if (category == TQChar::Mark_NonSpacing) - goto nsm; - - if (category == TQChar::Other_Surrogate) { - // char stop only on first pair - if (uc[i].isHighSurrogate() && i < (len - 1) && uc[i + 1].isLowSurrogate()) - goto nsm; - // ### correctly handle second surrogate - } - - if (ncls == TQUnicodeTables::LineBreak_SP) { - charAttributes[i].softBreak = FALSE; - charAttributes[i].whiteSpace = TRUE; - charAttributes[i].charStop = TRUE; - cls = ncls; - continue; - } + bool prevIsHighSurrogate = uc[0].isHighSurrogate(); + for (int i = 1; i < len; ++i) + { + // Don't stop on low surrogate characters of complete valid pairs + if (prevIsHighSurrogate && uc[i].isLowSurrogate()) + { + prevIsHighSurrogate = false; + charAttributes[i].softBreak = FALSE; + charAttributes[i].whiteSpace = FALSE; + charAttributes[i].charStop = FALSE; + continue; + } + prevIsHighSurrogate = uc[i].isHighSurrogate(); + int ncls = ::lineBreakClass(uc[i]); + int category = ::category(uc[i]); + if (category == TQChar::Mark_NonSpacing) + { + charAttributes[i].softBreak = FALSE; + charAttributes[i].whiteSpace = FALSE; + charAttributes[i].charStop = FALSE; + continue; + } - if (cls == TQUnicodeTables::LineBreak_SA && ncls == TQUnicodeTables::LineBreak_SA) { - // two complex chars (thai or lao), thai_attributes might override, but here - // we do a best guess - charAttributes[i].softBreak = TRUE; - charAttributes[i].whiteSpace = FALSE; - charAttributes[i].charStop = TRUE; - cls = ncls; - continue; - } - { - int tcls = ncls; - if (tcls >= TQUnicodeTables::LineBreak_SA) - tcls = TQUnicodeTables::LineBreak_ID; - if (cls >= TQUnicodeTables::LineBreak_SA) - cls = TQUnicodeTables::LineBreak_ID; - - bool softBreak; - int brk = breakTable[cls][tcls]; - if (brk == Ibk) - softBreak = (cls == TQUnicodeTables::LineBreak_SP); - else - softBreak = (brk == Dbk); -// tqDebug("char = %c %04x, cls=%d, ncls=%d, brk=%d soft=%d", uc[i].cell(), uc[i].unicode(), cls, ncls, brk, charAttributes[i].softBreak); - charAttributes[i].softBreak = softBreak; + if (ncls == TQUnicodeTables::LineBreak_SP) { + charAttributes[i].softBreak = FALSE; + charAttributes[i].whiteSpace = TRUE; + charAttributes[i].charStop = TRUE; + cls = ncls; + continue; + } + + if (cls == TQUnicodeTables::LineBreak_SA && ncls == TQUnicodeTables::LineBreak_SA) + { + // two complex chars (thai or lao), thai_attributes might override, but here + // we do a best guess + charAttributes[i].softBreak = TRUE; charAttributes[i].whiteSpace = FALSE; charAttributes[i].charStop = TRUE; cls = ncls; + continue; } - continue; - nsm: - charAttributes[i].softBreak = FALSE; - charAttributes[i].whiteSpace = FALSE; - charAttributes[i].charStop = FALSE; + + int tcls = ncls; + if (tcls >= TQUnicodeTables::LineBreak_SA) + tcls = TQUnicodeTables::LineBreak_ID; + if (cls >= TQUnicodeTables::LineBreak_SA) + cls = TQUnicodeTables::LineBreak_ID; + + bool softBreak; + int brk = breakTable[cls][tcls]; + if (brk == Ibk) + softBreak = (cls == TQUnicodeTables::LineBreak_SP); + else + softBreak = (brk == Dbk); + // tqDebug("char = %c %04x, cls=%d, ncls=%d, brk=%d soft=%d", uc[i].cell(), uc[i].unicode(), cls, ncls, brk, charAttributes[i].softBreak); + charAttributes[i].softBreak = softBreak; + charAttributes[i].whiteSpace = FALSE; + charAttributes[i].charStop = TRUE; + cls = ncls; } } diff --git a/src/tools/tqglobal.h b/src/tools/tqglobal.h index b49fdc242..a227392a3 100644 --- a/src/tools/tqglobal.h +++ b/src/tools/tqglobal.h @@ -70,7 +70,6 @@ UNIXWARE - UnixWare 7, Open UNIX 8 AIX - AIX HURD - GNU Hurd - DGUX - DG/UX DYNIX - DYNIX/ptx TQNX - TQNX TQNX6 - TQNX RTP 6.1 @@ -130,8 +129,6 @@ # define Q_OS_AIX #elif defined(__Lynx__) # define Q_OS_LYNX -#elif defined(__DGUX__) -# define Q_OS_DGUX #elif defined(__QNXNTO__) # define Q_OS_QNX6 #elif defined(__QNX__) diff --git a/src/widgets/tqlineedit.cpp b/src/widgets/tqlineedit.cpp index 2267706d4..94cc54bc8 100644 --- a/src/widgets/tqlineedit.cpp +++ b/src/widgets/tqlineedit.cpp @@ -860,10 +860,18 @@ void TQLineEdit::backspace() if ( d->hasSelectedText() ) { d->removeSelectedText(); } else if ( d->cursor ) { + --d->cursor; + if ( d->maskData ) { + d->cursor = d->prevMaskBlank( d->cursor ); + } + // second half of a surrogate, check if we have the first half as well, + // if yes delete both at once + if (d->cursor > 0 && d->text.at(d->cursor).isLowSurrogate() && + d->text.at(d->cursor - 1).isHighSurrogate()) { + d->del(true); --d->cursor; - if ( d->maskData ) - d->cursor = d->prevMaskBlank( d->cursor ); - d->del( TRUE ); + } + d->del(true); } d->finishChange( priorState ); } diff --git a/src/widgets/tqtextedit.cpp b/src/widgets/tqtextedit.cpp index cc88b3dd9..7ea000f21 100644 --- a/src/widgets/tqtextedit.cpp +++ b/src/widgets/tqtextedit.cpp @@ -1782,8 +1782,20 @@ void TQTextEdit::doKeyboardAction( KeyboardAction action ) undoRedoInfo.index = cursor->index(); undoRedoInfo.d->text = TQString::null; } - undoRedoInfo.d->text.insert( 0, cursor->paragraph()->at( cursor->index()-1 ), TRUE ); - undoRedoInfo.index = cursor->index()-1; + int cur_idx = cursor->index(); + const TQTextParagraph *para = cursor->paragraph(); + if (para->at(cur_idx - 1)->c.isLowSurrogate() && cur_idx > 1 && + para->at(cur_idx - 2)->c.isHighSurrogate()) + { + undoRedoInfo.d->text.insert( 0, para->at(cur_idx - 1), TRUE ); + undoRedoInfo.d->text.insert( 0, para->at(cur_idx - 2), TRUE ); + undoRedoInfo.index = cursor->index() - 2; + } + else + { + undoRedoInfo.d->text.insert( 0, para->at(cur_idx - 1), TRUE ); + undoRedoInfo.index = cursor->index() - 1; + } } cursor->removePreviousChar(); lastFormatted = cursor->paragraph(); |