MarkupFoldColor: bad index, if source has exactly one line.
Original Reporter info from Mantis: Martin @martin_frb
-
Reporter name: Martin Friebe
Original Reporter info from Mantis: Martin @martin_frb
- Reporter name: Martin Friebe
Description:
Compile IDE with -dAssertSynMemIndex
- Open a new project (any type).
- Remove all, but one line (gutter only shows "1")
- Tools > Option > Editor > color: Change any one color.
Bad index exception, as in stack below.
Reason:
HIghilighter send lines changed from line 1 (first line) to line 1 (last line)
TSynEditMarkupFoldColors.DoTextChanged(pStartLine, pEndLine, pCountDiff: Integer);
pEndLine will be 1
line 1099
if pEndLine < 0 then
pEndLine := pStartLine
else
// pEndLine seems to be the first line after the change
pEndLine := pEndLine - 1;
pEndLine becomes 0.
lEndLine := pEndLine;
FColumnCache[ToIdx(lEndLine)] := FirstCharacterColumn[ToIdx(lEndLine)];
ToIdx(lEndLine) is -1
FColumnCache starts at 0.
---
Not tested what happens with 0 lines (new files, never hit a single keystroke - internally 0 lines)
Steps to reproduce:
#0 fpc_raiseexception(TOBJECT($000000007FFFFFFF), POINTER($000000004B249CF8), POINTER(nil)) at c:\FPC\fpc_3.0.4\source\rtl\win64\seh64.inc:288
#1 SETCOLUMNDATA(TSYNEDITMARKUPFOLDCOLORSCOLUMNCACHE($0000000040AB1430), -1, 2147483647) at B:\lazarus_latest_svn_2\components\synedit\syneditmarkupfoldcoloring.pas:270
#2 DOTEXTCHANGED(TSYNEDITMARKUPFOLDCOLORS($000000003EA50E70), 1, 0, 0) at B:\lazarus_latest_svn_2\components\synedit\syneditmarkupfoldcoloring.pas:1105
#3 TEXTCHANGED(TSYNEDITMARKUP($000000003EA50E70), 1, 1, 0) at B:\lazarus_latest_svn_2\components\synedit\syneditmarkup.pp:483
#4 TEXTCHANGED(TSYNEDITMARKUPMANAGER($000000004099B7F0), 1, 1, 0) at B:\lazarus_latest_svn_2\components\synedit\syneditmarkup.pp:677
#5 HIGHLIGHTERATTRCHANGED(TCUSTOMSYNEDIT($0000000040AC3130), TOBJECT($000000003B74A2A0)) at B:\lazarus_latest_svn_2\components\synedit\synedit.pp:8725
#6 CALLNOTIFYEVENTS(TMETHODLIST($000000003B6FAC10), TOBJECT($000000003B74A2A0)) at B:\lazarus_latest_svn_2\components\lazutils\lazmethodlist.pas:334
#7 DEFHIGHLIGHTCHANGE(TSYNCUSTOMHIGHLIGHTER($000000003B74A2A0), TOBJECT($000000003B74A2A0)) at B:\lazarus_latest_svn_2\components\synedit\synedithighlighter.pp:1501
#8 ENDUPDATE(TSYNCUSTOMHIGHLIGHTER($000000003B74A2A0)) at B:\lazarus_latest_svn_2\components\synedit\synedithighlighter.pp:1345
#9 UPDATEHIGHLIGHTERS(TMAINIDEBASE($000000000750C830), True) at B:\lazarus_latest_svn_2\ide\mainbase.pas:1818
#10 EDITOROPTIONSAFTERWRITE(TMAINIDE($000000000750C830), TOBJECT($0000000007400F50), False) at B:\lazarus_latest_svn_2\ide\main.pp:5191
#11 DOAFTERWRITE(TABSTRACTIDEOPTIONS($0000000007400F50), False) at B:\lazarus_latest_svn_2\components\buildintf\ideoptionsintf.pas:403
#12 DOAFTERWRITE(TEDITOROPTIONS($0000000007400F50), False) at B:\lazarus_latest_svn_2\ide\editoroptions.pp:5349
#13 WRITEALL(TIDEOPTIONSDIALOG($00000000428589B0), False) at B:\lazarus_latest_svn_2\ide\ideoptionsdlg.pas:411
#14 DOOPENIDEOPTIONS(TMAINIDE($000000000750C830), TABSTRACTIDEOPTIONSEDITORCLASS(nil), nil, nil, -1, []) at B:\lazarus_latest_svn_2\ide\main.pp:5043
#15 DOOPENIDEOPTIONS(TLAZIDEINTERFACE($000000000750C830), TABSTRACTIDEOPTIONSEDITORCLASS(nil), nil) at B:\lazarus_latest_svn_2\components\ideintf\lazideintf.pas:784
#16 MNUENVGENERALOPTIONSCLICKED(TMAINIDE($000000000750C830), TOBJECT($0000000024C52820)) at B:\lazarus_latest_svn_2\ide\main.pp:4966
#17 MENUITEMCLICK(TIDEMENUITEM($0000000024C52820), TOBJECT($000000002162E440)) at B:\lazarus_latest_svn_2\components\ideintf\menuintf.pas:547
#18 MENUITEMCLICK(TIDEMENUCOMMAND($0000000024C52820), TOBJECT($000000002162E440)) at B:\lazarus_latest_svn_2\components\ideintf\menuintf.pas:1699
#19 CLICK(TMENUITEM($000000002162E440)) at B:\lazarus_latest_svn_2\lcl\include\menuitem.inc:83
#20 DOCLICKED(TMENUITEM($000000002162E440), 0) at B:\lazarus_latest_svn_2\lcl\include\menuitem.inc:296
#21 DISPATCH(TOBJECT($000000002162E440), 0) at c:\FPC\fpc_3.0.4\source\rtl\inc\objpas.inc:602
#22 DOWINDOWPROC(TWINDOWPROCHELPER($00000000013FF6C8)) at B:\lazarus_latest_svn_2\lcl\interfaces\win32\win32callback.inc:2141
#23 WINDOWPROC(42731090, 273, 243, 0) at B:\lazarus_latest_svn_2\lcl\interfaces\win32\win32callback.inc:2771
#24 CUSTOMFORMWNDPROC(42731090, 273, 243, 0) at B:\lazarus_latest_svn_2\lcl\interfaces\win32\win32wsforms.pp:397
#25 user32:CallWindowProcW+957 at :0
#26 HANDLEMESSAGE(TAPPLICATION($00000000015B7D80)) at B:\lazarus_latest_svn_2\lcl\include\application.inc:1208
#27 RUNLOOP(TAPPLICATION($00000000015B7D80)) at B:\lazarus_latest_svn_2\lcl\include\application.inc:1327
#28 APPRUN(TWIDGETSET($00000000015B8260), TAPPLICATIONMAINLOOP($00000000013FFDE8)) at B:\lazarus_latest_svn_2\lcl\include\interfacebase.inc:54
#29 RUN(TAPPLICATION($00000000015B7D80)) at B:\lazarus_latest_svn_2\lcl\include\application.inc:1315
#30 main at B:\lazarus_latest_svn_2\ide\lazarus.pp:153
#31 MAIN_WRAPPER(Internal error: Missing data location, Internal error: Missing data location) at c:\FPC\fpc_3.0.4\source\rtl\win64\system.pp:115
Mantis conversion info:
- Mantis ID: 37325
- Assignee Gitlab user: @PascalRiekenberg
- Assignee Mantis username: PascalR
- Assignee name: Pascal Riekenberg
- OS: win 10
- OS Build: 10
- Platform: 64bit Intel
- Version: 2.1 (SVN)
- Fixed in revision: 63550 (#b8d03d0e)
- Target version: 2.2