Path to extending Lyx to a full featured Jupyter-like IDE
Allen Barker
Allen.L.Barker at gmail.com
Tue Mar 17 22:12:47 UTC 2020
On 3/16/20 1:03 AM, Richard Kimberly Heck wrote:
> On 3/13/20 2:32 PM, Allen Barker wrote:
>>
>> One thing I noticed is that after an external edit to a text inset
>> (both Flex and ERT) in either gvim or gedit, where the file is saved
>> (even if the text is not changed), the inset has an extra newline
>> added to the end after the inset-end-edit.
>
> I see that, too. I am not sure what is causing it.
It's happening because on a write Vim and gview by default
always add an EOL at the end of a file if there isn't one (at
least on Posix systems). Lyx doesn't use that Posix
convention, at least in this case. If the last line in the
inset contains text then the file Lyx writes does not end in
EOL and Vim gives a warning notification [noeol] at the
bottom.
Adding this line in .vimrc:
set nofixendofline
makes the inset editing work as expected for insets which
don't end in newline.
But if the inset ends in newline then that last (empty) line
doesn't show up in the editor for editing whether or not that
option is set.
https://stackoverflow.com/questions/729692/why-should-text-files-end-with-a-newline
>> The code fix that I'm working with now is to replace this line (609) in
>> src/insets/InsetCollapsible.cpp:
>>
>> theFormats().edit(buffer(), tempfilename, format);
>>
>> with this:
>>
>> if (cmd.argument() == "noeditor")
>> cur.message(from_utf8(name));
>> else
>> theFormats().edit(buffer(), tempfilename, format);
>>
>> That seems to work (assuming I haven't overlooked something) and creates
>> the parameter "noeditor" for the inset-edit LFUN which just returns the
>> temporary filename.
>>
>> The question is then whether that is good from an API viewpoint.
>
> It seems all right, I think.
>
>
>> The inset-edit LFUN already takes a filename parameter, but that
>> parameter is
>> not respected in the InsetCollapsible::doDispatch routine anyway. In
>> the case of collapsible insets a temp file is always used.
>
> The filename is only used with 'file based' insets, or so it says in
> LyXAction.cpp.
> Those are cases like the bibliography inset where it would make sense to
> specify
> a filename. So, in the case of collapsible insets, it doesn't, and so
> "noeditor" won't
> yield any conflict.
After I test the code some more I'll put an enhancement request
ticket on the bug tracker with the proposed patch.
More information about the lyx-devel
mailing list