Golded+ can crash in editor if line is 0 char long.
This commit is contained in:
parent
2882ba419c
commit
86c2e2973e
@ -725,14 +725,16 @@ int IEclass::downoneline(uint __row) {
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
void IEclass::GoEOL() {
|
||||
|
||||
void IEclass::GoEOL()
|
||||
{
|
||||
GFTRK("EditGoEOL");
|
||||
|
||||
// Move cursor to the last char on the line
|
||||
col = currline->txt.length();
|
||||
if((currline->txt[col-1] == '\n') or ((col != mincol) and (currline->txt[col-1] == ' ')))
|
||||
--col;
|
||||
if (mincol != (col = currline->txt.length()))
|
||||
{
|
||||
if ((currline->txt[col-1] == '\n') || (currline->txt[col-1] == ' '))
|
||||
--col;
|
||||
}
|
||||
|
||||
// String must not be longer than the window width
|
||||
_test_haltab(col > maxcol, col, maxcol);
|
||||
@ -1276,14 +1278,20 @@ void IEclass::insertchar(char __ch) {
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
void IEclass::DelChar() {
|
||||
|
||||
void IEclass::DelChar()
|
||||
{
|
||||
GFTRK("EditDelChar");
|
||||
|
||||
Line* _thisline = currline;
|
||||
Line* _nextline = currline->next;
|
||||
uint _thislen = _thisline->txt.length();
|
||||
|
||||
if (!_nextline && (col == _thislen - 1) && (_thisline->txt[col] == '\n'))
|
||||
{
|
||||
GFTRK(0);
|
||||
return;
|
||||
}
|
||||
|
||||
// Cannot delete at or beyond the nul-terminator
|
||||
if(col < _thislen) {
|
||||
Undo->PushItem(EDIT_UNDO_DEL_CHAR|batch_mode);
|
||||
|
Reference in New Issue
Block a user