1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-02-15 04:32:24 +00:00

dtinfo: fix a highlighting issue.

This commit is contained in:
Liang Chang 2022-02-18 10:29:29 +08:00
parent b796f9fce4
commit bad30e1b1a
4 changed files with 17 additions and 15 deletions

View file

@ -256,14 +256,14 @@ DtCvStrVccToIndex(_DtCvSegment* seg, unsigned int vcc)
if (seg->type & _DtCvWIDE_CHAR) {
wchar_t* seg_str = (wchar_t*)seg->handle.string.string;
for (; *seg_str && rel_vcc > 0; seg_str++, index++) {
if (!isspace(*seg_str))
if (!ISSPACE_C(*seg_str))
rel_vcc--;
}
if (*seg_str == 0 && rel_vcc > 0)
index = (unsigned int)-1;
else {
for (; *seg_str; seg_str++, index++) {
if (!isspace(*seg_str))
if (!ISSPACE_C(*seg_str))
break;
}
}
@ -271,7 +271,7 @@ DtCvStrVccToIndex(_DtCvSegment* seg, unsigned int vcc)
else {
unsigned char* seg_str = (unsigned char*)seg->handle.string.string;
while (*seg_str && rel_vcc > 0) {
if (!isspace(*seg_str))
if (!ISSPACE_C(*seg_str))
rel_vcc--;
int mbl = mblen((char *) seg_str, MB_CUR_MAX);
@ -289,7 +289,7 @@ DtCvStrVccToIndex(_DtCvSegment* seg, unsigned int vcc)
index = (unsigned int)-1;
else {
for (; *seg_str; seg_str++, index++) {
if (!isspace(*seg_str))
if (!ISSPACE_C(*seg_str))
break;
}
}
@ -310,14 +310,14 @@ DtCvStrVcLenSync(_DtCvSegment* seg)
if (seg->type & _DtCvWIDE_CHAR) {
wchar_t* seg_str = (wchar_t*)seg->handle.string.string;
for (; *seg_str; seg_str++) {
if (!isspace(*seg_str))
if (!ISSPACE_C(*seg_str))
vclen++;
}
}
else {
unsigned char* seg_str = (unsigned char*)seg->handle.string.string;
while (*seg_str) {
if (!isspace(*seg_str))
if (!ISSPACE_C(*seg_str))
vclen++;
int mbl = mblen((char *) seg_str, MB_CUR_MAX);
@ -569,7 +569,7 @@ highlight_search_hit(_DtCvSegment* seg, unsigned int vcc, unsigned int vlen)
unsigned char *seg_str = (unsigned char*)seg->handle.string.string;
for (int i = 0; i < rel_vcc; ++i) {
if (isspace(*seg_str)) {
if (ISSPACE_C(*seg_str)) {
++seg_str;
continue;
}
@ -581,7 +581,7 @@ highlight_search_hit(_DtCvSegment* seg, unsigned int vcc, unsigned int vlen)
}
for (int i = 0; i < vlen; ++i) {
if (isspace(*seg_str)) {
if (ISSPACE_C(*seg_str)) {
++seg_str;
++len;
continue;

View file

@ -1282,7 +1282,7 @@ CanvasRenderer::handle_olias_attributes(ElementFeatures &features,
assert( mb_len > 0 );
if (mb_len == 1) {
const unsigned char ch = (unsigned char)*p++;
if (isspace(ch))
if (ISSPACE_C(ch))
continue;
}
else
@ -1293,7 +1293,7 @@ CanvasRenderer::handle_olias_attributes(ElementFeatures &features,
#else
while (*p)
{
if (!isspace(*p))
if (!ISSPACE_C(*p))
{
vcc++ ;
}
@ -1673,7 +1673,7 @@ CanvasRenderer::really_insert_string (_DtCvSegment *container,
if (strseg->type & _DtCvWIDE_CHAR) {
wchar_t *p;
for (p = (wchar_t*)string; *p; p++) {
if (!isspace(*p))
if (!ISSPACE_C(*p))
scd.vclen()++;
}
}
@ -1683,7 +1683,7 @@ CanvasRenderer::really_insert_string (_DtCvSegment *container,
while (*p) {
int mbl = mblen((char *) p, MB_CUR_MAX);
if (!isspace(*p))
if (!ISSPACE_C(*p))
scd.vclen()++;
if (mbl < 0) ++p;

View file

@ -395,7 +395,7 @@ DtSR_SearchResultsEntry::create_matches()
while (off > 0) {
int scanned = 0;
if (isspace(*cursor)) {
if (ISSPACE_C(*cursor)) {
scanned++;
}
else if (*cursor == ShiftIn || *cursor == ShiftOut) {
@ -424,11 +424,11 @@ DtSR_SearchResultsEntry::create_matches()
int len = atoi(len_str);
// remove leading white-spaces
for (; len && isspace(*cursor); cursor++, len--);
for (; len && ISSPACE_C(*cursor); cursor++, len--);
// remove trailing white-spaces
if (len > 0) {
for (const char *p = cursor + len - 1; isspace(*p); p--, len--);
for (const char *p = cursor + len - 1; ISSPACE_C(*p); p--, len--);
}
if (len == 0)

View file

@ -132,6 +132,8 @@ typedef unsigned char u_char;
#define ON_DEBUG(stmt)
#endif
#define ISSPACE_C(C) (C == ' ' || C > 0x8 && C < 0x14)
#include <stddef.h>
#include <stdlib.h>