View Issue Details

IDProjectCategoryView StatusLast Update
0038195LazarusCompilerpublic2021-02-17 09:47
ReporterOkobaPatino Assigned ToJuha Manninen  
Status closedResolutionfixed 
Product Version2.1 (SVN) 
Summary0038195: JCF should set the cursor at the line end
DescriptionBefore solving 0038178, when you were at the line end and format the code, JCF set the cursor at the line end after the format, for example:
procedure TForm1.FormCreate(Sender: TObject);
Notice the "|", it is at position 8; after format, the code with new spaces will become:
procedure TForm1.FormCreate(Sender: TObject);
  a := b;
Before the update, it would set the cursor at 10:
  a := b;|
But now it keeps it at 8:
  a := |b;

I didn't find any document about how it should behave. Still, I think it is preferable that when someone writes a line and, after the end, hit the format, it should keep the cursor at the line ending not the lat position, but when the cursor is the middle of the line and then formats it, keep it as is.
TagsNo tags attached.
Fixed in Revision
Attached Files


related to 0038196 resolvedJuha Manninen JCF will move the breakpoints 



2020-12-10 08:29

reporter   ~0127504

Hey @DomingoGP, this one may interest you.

Domingo Galmés

2020-12-10 21:32

reporter   ~0127513

I think that reformatting the whole file after each line isn't the best use case of JCF.
It would be better to select the line and format only the selection, perhaps using a macro that selects the line, formats it and goes to the end.
In this case the cursor is positioned at the end of the selection and only changes the bookmarks and breakpoints of the selection.

When reformatting the entire file the cursor should not necessarily stay on the same line, lines may have been added or removed
therefore it is difficult to reposition it at the end of the current line.

If we format the whole file, then we would have to resynchronize all the bookmarks and breakpoints which is beyond my knowledge of the internal programming of the IDE, maybe someone with more knowledge of the ide knows how to do it.

Anyway, in order to keep the bookmarks and breakpoinds, we should do a merge of the original code and the formatted code (like diff + patch) instead of copying all the formatted code. Changing only the modified lines and resyncing later bookmarks and breakpoints. Which is not an easy task.

Basically the problem with breakpoints and also with bookmarks is because we replace all the editor text after formatting, which in my opinion is better than the previous version that synchronized badly, replacing almost all the lines from the first difference and adding blank lines throughout the code at "random" positions.


2020-12-10 21:51

reporter   ~0127517

Last edited: 2020-12-10 21:51

View 2 revisions

I explained at 0038196

Juha Manninen

2020-12-10 22:42

developer   ~0127520

Guys, you should use the mailing list or forum to discuss ideas and maybe test things with experimental patches.
Maybe other people get inspired to join, too.
This bug tracker can then be used to deliver a well thought of patch finally.


2020-12-10 23:10

reporter   ~0127522

You are right Juha. Although this was not much of sharing ideas as It was a reporting back that a feature made broke something.
Domingo is doing all the works and I am reporting feedbacks on the issues.


2021-02-16 14:56

reporter   ~0128951

Last edited: 2021-02-16 15:00

View 2 revisions

@JuhaManninen this is fixed in 0038196, thanks to @DomingoGP.

Juha Manninen

2021-02-16 15:38

developer   ~0128954



2021-02-17 09:47

reporter   ~0128963


Issue History

Date Modified Username Field Change
2020-12-10 08:28 OkobaPatino New Issue
2020-12-10 08:29 OkobaPatino Note Added: 0127504
2020-12-10 21:32 Domingo Galmés Note Added: 0127513
2020-12-10 21:51 OkobaPatino Note Added: 0127517
2020-12-10 21:51 OkobaPatino Note Edited: 0127517 View Revisions
2020-12-10 22:29 Juha Manninen Relationship added related to 0038196
2020-12-10 22:42 Juha Manninen Note Added: 0127520
2020-12-10 23:10 OkobaPatino Note Added: 0127522
2021-02-16 14:56 OkobaPatino Note Added: 0128951
2021-02-16 15:00 OkobaPatino Note Edited: 0128951 View Revisions
2021-02-16 15:38 Juha Manninen Assigned To => Juha Manninen
2021-02-16 15:38 Juha Manninen Status new => resolved
2021-02-16 15:38 Juha Manninen Resolution open => fixed
2021-02-16 15:38 Juha Manninen LazTarget => -
2021-02-16 15:38 Juha Manninen Note Added: 0128954
2021-02-17 09:47 OkobaPatino Status resolved => closed
2021-02-17 09:47 OkobaPatino Note Added: 0128963