few optimizations

This commit is contained in:
Ianos Gnatiuc
2005-11-01 02:31:41 +00:00
parent 21b44b65d2
commit 073e52bb3d
12 changed files with 49 additions and 119 deletions

View File

@@ -2026,12 +2026,15 @@ void IEclass::ToggleCase() {
GFTRK("EditToggleCase");
if(col < currline->txt.length()) {
if (col < currline->txt.length())
{
Undo->PushItem(EDIT_UNDO_OVR_CHAR);
if(g_toupper(currline->txt[col]) == currline->txt[col])
currline->txt[col] = g_tolower(currline->txt[col]);
char chr = currline->txt[col];
if (g_isupper(chr))
currline->txt[col] = g_tolower(chr);
else
currline->txt[col] = g_toupper(currline->txt[col]);
currline->txt[col] = g_toupper(chr);
}
GFTRK(NULL);
@@ -2045,23 +2048,23 @@ void IEclass::ToggleCaseChar(gkey key,
Line *ln, int n)
{
int oldchar = *it;
int newchar = *it;
int newchar;
switch (key)
{
case KK_EditToLower:
newchar = g_tolower(*it);
newchar = g_tolower(oldchar);
break;
case KK_EditToUpper:
newchar = g_toupper(*it);
newchar = g_toupper(oldchar);
break;
case KK_EditToggleCase:
if (g_toupper(*it) == oldchar)
newchar = g_tolower(*it);
if (g_isupper(oldchar))
newchar = g_tolower(oldchar);
else
newchar = g_toupper(*it);
newchar = g_toupper(oldchar);
break;
}

View File

@@ -1696,8 +1696,8 @@ void Latin2Local(char *str)
byte left = i ? str[i-1] : 0;
byte right = str[i+1];
if (((left >= 0x80) && (g_toupper(left) != g_tolower(left))) ||
((right >= 0x80) && (g_toupper(right) != g_tolower(right))))
if (((left >= 0x80) && g_isalpha(left )) ||
((right >= 0x80) && g_isalpha(right)))
{
str[i] = xch;