mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-06-23 14:15:26 -06:00
Core: IsDoubleWidth (thanks ismail)
git-svn-id: svn://ultimatepp.org/upp/trunk@13710 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
e5b004d40a
commit
1bb18b43bd
4 changed files with 34 additions and 10 deletions
|
|
@ -480,7 +480,7 @@ void LineEdit::Paint0(Draw& w) {
|
|||
x = fsz.cx * gp;
|
||||
}
|
||||
else
|
||||
if(IsCJKIdeograph(chr)) {
|
||||
if(IsDoubleWidth(chr)) {
|
||||
x += 2 * fsz.cx;
|
||||
gp += 2;
|
||||
}
|
||||
|
|
@ -508,7 +508,7 @@ void LineEdit::Paint0(Draw& w) {
|
|||
h.ink = color[INK_SELECTED];
|
||||
}
|
||||
int x = gp * fsz.cx - scx;
|
||||
bool cjk = IsCJKIdeograph(h.chr);
|
||||
bool cjk = IsDoubleWidth(h.chr);
|
||||
int xx = x + (gp + 1 + cjk) * fsz.cx;
|
||||
if(h.chr == '\t') {
|
||||
int ngp = (gp + tabsize) / tabsize * tabsize;
|
||||
|
|
@ -679,7 +679,7 @@ int64 LineEdit::GetGPos(int ln, int cl) const {
|
|||
if(*s == '\t')
|
||||
gl = (gl + tabsize) / tabsize * tabsize;
|
||||
else
|
||||
gl += 1 + IsCJKIdeograph(*s);
|
||||
gl += 1 + IsDoubleWidth(*s);
|
||||
if(cl < gl) break;
|
||||
s++;
|
||||
}
|
||||
|
|
@ -704,7 +704,7 @@ Point LineEdit::GetColumnLine(int64 pos) const {
|
|||
if(*s == '\t')
|
||||
p.x = (p.x + tabsize) / tabsize * tabsize;
|
||||
else
|
||||
p.x += 1 + IsCJKIdeograph(*s);
|
||||
p.x += 1 + IsDoubleWidth(*s);
|
||||
s++;
|
||||
}
|
||||
return p;
|
||||
|
|
@ -1125,7 +1125,7 @@ void LineEdit::SetHBar()
|
|||
if(*s == '\t')
|
||||
pos = (pos + tabsize) / tabsize * tabsize;
|
||||
else
|
||||
pos += 1 + IsCJKIdeograph(*s);
|
||||
pos += 1 + IsDoubleWidth(*s);
|
||||
s++;
|
||||
}
|
||||
mpos = max(mpos, pos);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue