SynEdit: fix caret pos, after delete/del-word with caret in middle of tab-char. issue #0018960

git-svn-id: trunk@29975 -
This commit is contained in:
martin 2011-03-21 21:12:13 +00:00
parent cc790adde3
commit d00c1cc10d
2 changed files with 17 additions and 1 deletions

View File

@ -6274,6 +6274,7 @@ begin
// delete char
Counter:=GetCharLen(Temp,LogCaretXY.X);
FTheLinesView.EditDelete(LogCaretXY.X, CaretY, Counter);
SetLogicalCaretXY(LogCaretXY);
end else begin
// join line with the line after
if CaretY < FTheLinesView.Count then begin
@ -6303,7 +6304,7 @@ begin
FInternalBlockSelection.SetSelTextPrimitive(smNormal, nil);
if Helper <> '' then
FTabbedLinesView.EditInsert(CaretX, CaretY, Helper);
CaretXY := Caret;
FCaret.BytePos := FInternalBlockSelection.StartBytePos + length(Helper);
end;
end;
ecDeleteLastWord, ecDeleteBOL:

View File

@ -1497,6 +1497,21 @@ begin
test1('ecDeleteLastChar EOL', t1 + t2, 1,2, ecDeleteLastChar, 'abcdef' + t2, 7,1);
test1('ecDeleteLastWord', t3, 8,1, ecDeleteLastWord, '123 7' + cr, 5,1);
//delete in tab
SynEdit.TabWidth := 4;
test1('ecDeleteChar in tab 1', #9'abcdef'+cr, 3,1, ecDeleteChar, 'abcdef' + cr, 1,1);
test1('ecDeleteChar in tab 2', 'x'#9'abcdef'+cr, 3,1, ecDeleteChar, 'xabcdef' + cr, 2,1);
test1('ecDeleteChar before tab', 'xy'#9'abcdef'+cr, 3,1, ecDeleteChar, 'xyabcdef' + cr, 3,1);
test1('ecDeleteChar after tab', 'xy'#9'abcdef'+cr, 5,1, ecDeleteChar, 'xy'#9'bcdef' + cr, 5,1);
test1('ecDeleteLastChar in tab 1', #9'abcdef'+cr, 3,1, ecDeleteLastChar, 'abcdef' + cr, 1,1);
test1('ecDeleteLastChar in tab 2', 'x'#9'abcdef'+cr, 3,1, ecDeleteLastChar, 'xabcdef' + cr, 2,1);
test1('ecDeleteLastChar before tab', 'xy'#9'abcdef'+cr, 3,1, ecDeleteLastChar, 'x'#9'abcdef' + cr, 2,1);
test1('ecDeleteLastChar after tab', 'xy'#9'abcdef'+cr, 5,1, ecDeleteLastChar, 'xyabcdef' + cr, 3,1);
test1('ecDeleteWord in tab 1', #9'abcdef'+cr, 3,1, ecDeleteWord, 'abcdef' + cr, 1,1);
end;