[RFC][PATCH] Change to GuiView::goToFileRow

Stephan Witt st.witt at gmx.net
Mon Feb 17 16:14:28 UTC 2020


Am 17.02.2020 um 11:00 schrieb Enrico Forestieri <forenr at lyx.org>:
> 
> On Mon, Feb 17, 2020 at 08:28:20AM +0100, Stephan Witt wrote:
>> Am 16.02.2020 um 22:02 schrieb Enrico Forestieri <forenr at lyx.org>:
>>> 
>>> On Sun, Feb 16, 2020 at 09:28:57PM +0100, Stephan Witt wrote:
>>>> Am 16.02.2020 um 17:54 schrieb Enrico Forestieri <forenr at lyx.org>:
>>>>> 
>>>>> On Sun, Feb 16, 2020 at 02:52:52PM +0100, Stephan Witt wrote:
>>>>>> 
>>>>>> The latest version of the mentioned patch I’ve used for 1. and 2. is
>>>>> 
>>>>> Thank you. It is surprising that only for the Mac absPath() expands
>>>>> symlinks. Anyway, I think I now understand the problem.
>>>>> 
>>>>> Please, can you report whether the attached patch works for you
>>>>> irrespectively of the Qt version?
>>>> 
>>>> Yes, it works too. But did you have any problem with my patch 
>>>> or do you think it’s not good?
>>> 
>>> No, it's simply that I think the previous code is easier to follow.
>> 
>> I had problems to understand it.
> 
> Then, we need a third opinion.
> 
>>>> I have to admit I like mine more.
>>> 
>>> ;-)
>>> 
>>>> Especially the subst part of the original code formally isn’t 100% correct.
>>> 
>>> Why?
>> 
>> Because of it "substitutes *all* instances of \a oldstr with \a newstr“
>> 
>> Maybe it’s nearly impossible to have realtmp more then once in file_name but
>> it’s not the same as „substitute the *first* instance \a oldstr with \a
>> newstr“
>> and that’s the goal.
> 
> Yes, this is technically correct but highly improbable.

True, but that was the problem to understand exactly.

> 
>> IMO the best solution is to use real path names entirely for buffer lookup
>> by temporary file names. The attached patch implements this idea. I think
>> this is much easier to follow too. ;-)
> 
> I like it. But it needs testing, of course.

For me it works with both Qt versions on Mac.
The GuiView::goToFileRow() is the only caller of BufferList::getBufferFromTmp().
Only the test of LFUN_SERVER_GOTO_FILE_ROW is to do.

* Qt version: 5.9.8
argument: /var/folders/1x/zm63s22x7s591xrlgm4rl9v40000gn/T/lyx_tmpdir.IrSFRJa98189/lyx_tmpbuf0/Tutorial.tex 586
file_name: /private/var/folders/1x/zm63s22x7s591xrlgm4rl9v40000gn/T/lyx_tmpdir.IrSFRJa98189/lyx_tmpbuf0/Tutorial.tex
realtmp:   /private/var/folders/1x/zm63s22x7s591xrlgm4rl9v40000gn/T/lyx_tmpdir.IrSFRJa98189
frontends/qt/GuiView.cpp (3694): goToFileRow: buffer lookup for /private/var/folders/1x/zm63s22x7s591xrlgm4rl9v40000gn/T/lyx_tmpdir.IrSFRJa98189/lyx_tmpbuf0/Tutorial.tex success

* Qt version: 5.12.6
argument: /var/folders/1x/zm63s22x7s591xrlgm4rl9v40000gn/T/lyx_tmpdir.YUIIWffFkCyn/lyx_tmpbuf0/Tutorial.tex 603
file_name: /private/var/folders/1x/zm63s22x7s591xrlgm4rl9v40000gn/T/lyx_tmpdir.YUIIWffFkCyn/lyx_tmpbuf0/Tutorial.tex
realtmp:   /private/var/folders/1x/zm63s22x7s591xrlgm4rl9v40000gn/T/lyx_tmpdir.YUIIWffFkCyn
frontends/qt/GuiView.cpp (3694): goToFileRow: buffer lookup for /private/var/folders/1x/zm63s22x7s591xrlgm4rl9v40000gn/T/lyx_tmpdir.YUIIWffFkCyn/lyx_tmpbuf0/Tutorial.tex success

Nonetheless I cannot test it with other Viewers and Linux or Windows.

Stephan


More information about the lyx-devel mailing list