PreviousNextTracker indexSee it online !

(33/39) 590 - patch for correct +line command line behavior

Problem:
1. When JEdit is open with one or more buffers and a file is opened via the command line with <file> +line:ll,cc -reuseview then JEdit doesn't scroll to the line,column position in the given file. However the caret is at the right position in the file (but it is not visible).
2. When JEdit is opened first time with command line <file> +line:ll,cc and "Restore previously open files on startup" is checked in Gobal Options - General, then also JEdit doesn't scroll to the line,column position in the given file.

Attached a patch which fixes this.
Potentially related: bug #3414 (2978040)

1. Problem is in JEdit.OpenFiles. gotoMarker is called within a loop, when +line command line argument is given. Code in gotoMarker is executed in a runAfterIoTasks runnable. gotoMarker code checks whether current view contains newly openen buffer, if not only caret position is set, but no scroll is performed.
Only after loop is ended, in jEdit.OpenFiles, view is set to the buffer belonging to the file given on the command line. This is too late, apparently runnable code of gotoMarker has already been executed (although one would expect otherwise).
Fix: after loop with gotoMarker check whether view is current buffer, if not and caret isn't visible then scroll to caret.

2. Problem is in JEdit.finishStartup. OpenFiles is called with null for view argument.
Solution: OpenFiles should be called with view as argument.

Remark: I'm not sure whether scrollToCaret(false) or scrollToCaret(true) should be used (concerning doElectricScroll).

Submitted wimwest - 2016-08-02 10:24:44.446000 Assigned
Priority 5 Labels
Status open Group None
Resolution None

Comments