Skip to content

Commit fddc241

Browse files
committed
Merge branch 'master' of github.com:elfmz/far2l into arclite2
2 parents 5351f6f + fb42f6f commit fddc241

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

far2l/src/edit.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -688,7 +688,7 @@ int Edit::CalcPosBwdTo(int Pos) const
688688

689689
do {
690690
--Pos;
691-
} while (Pos > 0 && CharClasses(Str[Pos]).Xxxfix());
691+
} while (Pos > 0 && Pos < StrSize && CharClasses(Str[Pos]).Xxxfix());
692692

693693
return Pos;
694694
}
@@ -2103,7 +2103,6 @@ int Edit::RealPosToCell(int PrevLength, int PrevPos, int Pos, int *CorrectPos)
21032103
if (Pos >= StrSize)
21042104
TabPos+= Pos - Index;
21052105
}
2106-
21072106
return TabPos;
21082107
}
21092108

@@ -2124,13 +2123,13 @@ int Edit::CellPosToReal(int Pos)
21242123

21252124
CellPos = NewCellPos;
21262125
} else {
2127-
CellPos+= CharClasses(Str[Index]).FullWidth() ? 2 : 1;
2126+
CharClasses cc(Str[Index]);
2127+
CellPos+= cc.FullWidth() ? 2 : cc.Xxxfix() ? 0 : 1;
21282128
while (Index + 1 < StrSize && CharClasses(Str[Index + 1]).Xxxfix()) {
21292129
Index++;
21302130
}
21312131
}
21322132
}
2133-
21342133
return Index;
21352134
}
21362135

0 commit comments

Comments
 (0)