Re: Workarea not updated after deleting display math, on current master

2024-04-16 Thread Scott Kostyshak
On Wed, Apr 17, 2024 at 12:04:24AM GMT, Jean-Marc Lasgouttes wrote:
> Le 12/04/2024 à 18:16, Scott Kostyshak a écrit :
> > To reproduce:
> > 
> > 1. Open the attached document.
> > 2. Select all.
> > 3. Backspace (to delete everything).
> > 
> > I get the attached screenshot.
> > 
> > Can anyone reproduce?
> 
> Yes!
> 
> > By the way, my secret goal with this batch of bug reports on current
> > master is to ruin JMarc's Friday evening/weekend :)
> > However, I think he has healthy work habits so hopefully he doesn't
> > check his emails.
> 
> So instead I spent my evening trying to fix what you just broke (the bug
> would not have existed if nobody had tried to trigger it).

;) 

> Does this work?

Yes, works well here! Thanks.

Scott


signature.asc
Description: PGP signature
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: [LyX/master] Defer construction of temporary cursor.

2024-04-16 Thread Scott Kostyshak
On Tue, Apr 16, 2024 at 11:02:03PM GMT, Jean-Marc Lasgouttes wrote:
> Le 16/04/2024 à 22:27, Scott Kostyshak a écrit :
> > On Tue, Apr 16, 2024 at 04:18:33PM GMT, Richard Kimberly Heck wrote:
> > > commit 4e8aa89eb96cd73e6630deea6fd6b9d3039aab6c
> > > Author: Richard Kimberly Heck 
> > > Date:   Tue Apr 16 12:15:50 2024 -0400
> > > 
> > >  Defer construction of temporary cursor.
> > >  We were doing this on every mouse movement. I.e., for every single
> > >  pixel the mouse traverses. It can be expensive if there are a lot
> > >  of math insets.
> > 
> > Nice! I'm curious, how did you come across this? Were you profiling or
> > just happened to be looking at that code?
> 
> Look here: https://www.lyx.org/trac/ticket/13050

Ah thanks for the reference!

Scott


signature.asc
Description: PGP signature
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: Workarea not updated after deleting display math, on current master

2024-04-16 Thread Jean-Marc Lasgouttes

Le 12/04/2024 à 18:16, Scott Kostyshak a écrit :

To reproduce:

1. Open the attached document.
2. Select all.
3. Backspace (to delete everything).

I get the attached screenshot.

Can anyone reproduce?


Yes!


By the way, my secret goal with this batch of bug reports on current
master is to ruin JMarc's Friday evening/weekend :)
However, I think he has healthy work habits so hopefully he doesn't
check his emails.


So instead I spent my evening trying to fix what you just broke (the bug 
would not have existed if nobody had tried to trigger it).


Does this work?

JMarc


From 05e5be4926ecd79f8263beae895e79b2f57bb61c Mon Sep 17 00:00:00 2001
From: Jean-Marc Lasgouttes 
Date: Tue, 16 Apr 2024 23:55:24 +0200
Subject: [PATCH] Always repaint the gray area below main inset

Now that SingleParUpdate does not always lead to a full screen update
when the height of the paragraph changes (see new behavior of
updateMatrics(bool)), it is necessary to make sure that the grey area
below the main page is always repainted.
---
 src/BufferView.cpp | 11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/BufferView.cpp b/src/BufferView.cpp
index 7abaea0d40..404e38cb5b 100644
--- a/src/BufferView.cpp
+++ b/src/BufferView.cpp
@@ -3711,7 +3711,13 @@ void BufferView::draw(frontend::Painter & pain, bool paint_caret)
 		// Draw everything.
 		tm.draw(pi, 0, y);
 
-		// and possibly grey out below
+		break;
+	}
+	LYXERR(Debug::PAINTING, (pain.isNull() ? "\t\t --- END NODRAW ---"
+	: "\t\t *** END DRAWING ***"));
+
+	// Possibly grey out below
+	if (d->update_strategy_ != NoScreenUpdate) {
 		pair lastpm = tm.last();
 		int const y2 = lastpm.second->bottom();
 
@@ -3720,10 +3726,7 @@ void BufferView::draw(frontend::Painter & pain, bool paint_caret)
 ? Color_background : Color_bottomarea;
 			pain.fillRectangle(0, y2, width_, height_ - y2, color);
 		}
-		break;
 	}
-	LYXERR(Debug::PAINTING, (pain.isNull() ? "\t\t --- END NODRAW ---"
-	: "\t\t *** END DRAWING ***"));
 
 	// The scrollbar needs an update.
 	// FIXME: does it always? see ticket #11947.
-- 
2.40.1

-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: SIGSEGV on current master when saving with cursor in subscript

2024-04-16 Thread Jean-Marc Lasgouttes

Le 16/04/2024 à 18:44, Jürgen Spitzmüller a écrit :

Am Dienstag, dem 16.04.2024 um 12:08 +0200 schrieb Jean-Marc
Lasgouttes:

I propose the following patch. Can you check that it works?


Works for me with both testcases.


Thanks for testing, it is now in master. Riki, I think it is worth 
backporting. Where can I put it? It is triggered by the biginset branch, 
but it has merit of its own IMO.


JMarc

--
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: [LyX/master] Defer construction of temporary cursor.

2024-04-16 Thread Jean-Marc Lasgouttes

Le 16/04/2024 à 22:27, Scott Kostyshak a écrit :

On Tue, Apr 16, 2024 at 04:18:33PM GMT, Richard Kimberly Heck wrote:

commit 4e8aa89eb96cd73e6630deea6fd6b9d3039aab6c
Author: Richard Kimberly Heck 
Date:   Tue Apr 16 12:15:50 2024 -0400

 Defer construction of temporary cursor.
 
 We were doing this on every mouse movement. I.e., for every single

 pixel the mouse traverses. It can be expensive if there are a lot
 of math insets.


Nice! I'm curious, how did you come across this? Were you profiling or
just happened to be looking at that code?


Look here: https://www.lyx.org/trac/ticket/13050

JMarc

--
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: [LyX/master] Defer construction of temporary cursor.

2024-04-16 Thread Scott Kostyshak
On Tue, Apr 16, 2024 at 04:18:33PM GMT, Richard Kimberly Heck wrote:
> commit 4e8aa89eb96cd73e6630deea6fd6b9d3039aab6c
> Author: Richard Kimberly Heck 
> Date:   Tue Apr 16 12:15:50 2024 -0400
> 
> Defer construction of temporary cursor.
> 
> We were doing this on every mouse movement. I.e., for every single
> pixel the mouse traverses. It can be expensive if there are a lot
> of math insets.
> ---

Nice! I'm curious, how did you come across this? Were you profiling or
just happened to be looking at that code?

Scott


signature.asc
Description: PGP signature
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: SIGSEGV on current master when saving with cursor in subscript

2024-04-16 Thread Scott Kostyshak
On Tue, Apr 16, 2024 at 06:44:25PM GMT, Jürgen Spitzmüller wrote:
> Am Dienstag, dem 16.04.2024 um 12:08 +0200 schrieb Jean-Marc
> Lasgouttes:
> > I propose the following patch. Can you check that it works?
> 
> Works for me with both testcases.

Works well here. Thanks!

Scott


signature.asc
Description: PGP signature
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: LyX v2.4.0 RC4 -> Unicode in Program Listing (again...)

2024-04-16 Thread José Matos
On Tue, 2024-04-16 at 17:22 +, Bernt Lie wrote:
> QUESTION 1: What is wrong? I *did* envoke the “-shell-escape” flag,
> didn’t I?

The shell-escape option is a per-document option.

In LyX, in the document that you want to use this option:

Document -> Settings -> Output
select the options that says "Allow running external programs"

The options that you passed to the converters do not work, basically
they are no-ops (do nothing).

I hope that this helps,
-- 
José Abílio
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


LyX v2.4.0 RC4 -> Unicode in Program Listing (again...)

2024-04-16 Thread Bernt Lie
OK -- this is the status on my on-going experimentation on Windows 11... (I 
hope I'm almost there):



1. I experiment with KOMA script Book

2. I have:

* Upgraded all packages in MikTeX

* Installed Pygments ("pip install Pygments" in Windows Prompt)

* Figured out where the "pygmetize" script is located on my computer,

  and added location to PATH.

* In the LyX document, Documents/Settings/Fonts, checked "use non-TeX fonts

* In the Documents/Settings/Listings, changed "Syntax Highlighting Package" 
to "minted"

  [This didn't work until I set the PATH to "pygmetize"]

* In Tools/Preferences/File Handling/Converters, added "-shell-escape" at 
the end

  of the Converter line:

[cid:image001.png@01DA9032.84834190]

  [This line is slightly different from the Embedded document, 
since that assumed pdflatex as converter).



3. STATUS:

[cid:image002.png@01DA9032.E4467C00]



QUESTION 1: What is wrong? I *did* envoke the “-shell-escape” flag, didn’t I?



QUESTION 2: By default, Ctrl+R is keyboard shortcut for generating PDF via 
pdflatex. After I chose “use non-TeX fonts”, Ctrl+R implies generating PDF via 
XeTeX. How can I change the set-up so that Ctrl+R implies using luatex?


-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: SIGSEGV on current master when saving with cursor in subscript

2024-04-16 Thread Jürgen Spitzmüller
Am Dienstag, dem 16.04.2024 um 12:08 +0200 schrieb Jean-Marc
Lasgouttes:
> I propose the following patch. Can you check that it works?

Works for me with both testcases.

-- 
Jürgen
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: [LyX/master] gbrief-2 loads babel internally. So don't load it ourselves.

2024-04-16 Thread Jürgen Spitzmüller
Am Samstag, dem 13.04.2024 um 07:36 +0200 schrieb Jürgen Spitzmüller:
> Am Samstag, dem 13.04.2024 um 05:34 + schrieb Juergen
> Spitzmueller:
> > commit c3c96a446b32ef77927b5e06436c2668d95dfd6d
> > Author: Juergen Spitzmueller 
> > Date:   Sat Apr 13 07:32:30 2024 +0200
> > 
> >     gbrief-2 loads babel internally. So don't load it ourselves.
> >     
> >     This makes the class fully functional with non-TeX fonts (it
> > uses
> >     \babelfont for the purpose). Before, docs were compiling but
> > the
> >     output was wrong.
> 
> Candidate for 2.4.1, Riki.

Riki, did you see this?

The same needs to be done for the obsolete g-brief (v. 1) layout.

-- 
Jürgen
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: SIGSEGV on current master when saving with cursor in subscript

2024-04-16 Thread Richard Kimberly Heck

On 4/16/24 06:08, Jean-Marc Lasgouttes wrote:

Le 13/04/2024 à 08:10, Jürgen Spitzmüller a écrit :

Note that this is not specific to this particularly inset. I can
reproduce with any other (text) inset, e.g.:

1. Start a new document.
2. Insert a Note inset
3. Save the (new) file (cursor still being in the Note inset).

=> Kaboom.


What happens is that Save As... reloads the buffer (for a reason that 
is not very clear at this point), 


I think this is primarily because Save As... changes the filename, 
unlike just Save. I have some dim memory of discussion of this.


Riki


--
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: 2.3.x does not compile on Windows

2024-04-16 Thread Yu Jin
Am Di., 16. Apr. 2024 um 14:14 Uhr schrieb Kornel Benko:

> Am Fri, 12 Apr 2024 21:50:28 +0200
> schrieb Yu Jin:
>
> > Am Fr., 12. Apr. 2024 um 09:56 Uhr schrieb Kornel Benko:
> >
> > > Am Thu, 11 Apr 2024 17:13:20 +0200
> > > schrieb Yu Jin:
> > >
> > > > Am Do., 11. Apr. 2024 um 10:17 Uhr schrieb Kornel Benko:
> > > >
> > > > > Am Wed, 10 Apr 2024 21:02:40 +0200
> > > > > schrieb Yu Jin:
> > > > >
> > >
> > > [snip]
> > >
> > > > > Please check ./development/cmake/modules/LyXMacros.cmake:471
> > > > >
> > > >
> > > > On the 2.3.x branch there LyXMacros.cmake file only contains  403
> lines.
> > > >
> > >
> > >
> > > I completely forgot the 2.3 branch.
> > >
> > > Please check development/cmake/modules/FindCXX11Compiler.cmake:47
> > > and set CXX11_FLAG_CANDIDATES appropriate.
> > > (You may also look at
> > > # git log development/cmake/modules/FindCXX11Compiler.cmake
> > > in lyx2.4 for changes prior to 2ec243d47)
> >
> >
> > I either don't understand what I need to do or it does not help either. I
> > put "--std=c++11" in there but it did not help, still the same error.
>
> Alternatively you can try setting CMAKE_CXX_STANDARD directly.
> Like in CMakeLists.txt:646
> -if(NOT MSVC)
> +if (MSVC)
> +   set(CMAKE_CXX_STANDARD 11)
> +else()
>
> Since I cannot test for MSVC, it is untested.
>

Does not seem to do anything, the standard set in Visual Studio is still
"Default (C++14)" and still the same error occurs.


-- 
  Eugene
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: 2.3.x does not compile on Windows

2024-04-16 Thread Kornel Benko
Am Fri, 12 Apr 2024 21:50:28 +0200
schrieb Yu Jin :

> Am Fr., 12. Apr. 2024 um 09:56 Uhr schrieb Kornel Benko :
> 
> > Am Thu, 11 Apr 2024 17:13:20 +0200
> > schrieb Yu Jin:
> >
> > > Am Do., 11. Apr. 2024 um 10:17 Uhr schrieb Kornel Benko:
> > >
> > > > Am Wed, 10 Apr 2024 21:02:40 +0200
> > > > schrieb Yu Jin:
> > > >
> >
> > [snip]
> >
> > > > Please check ./development/cmake/modules/LyXMacros.cmake:471
> > > >
> > >
> > > On the 2.3.x branch there LyXMacros.cmake file only contains  403 lines.
> > >
> >
> >
> > I completely forgot the 2.3 branch.
> >
> > Please check development/cmake/modules/FindCXX11Compiler.cmake:47
> > and set CXX11_FLAG_CANDIDATES appropriate.
> > (You may also look at
> > # git log development/cmake/modules/FindCXX11Compiler.cmake
> > in lyx2.4 for changes prior to 2ec243d47)
> 
> 
> I either don't understand what I need to do or it does not help either. I
> put "--std=c++11" in there but it did not help, still the same error.

Alternatively you can try setting CMAKE_CXX_STANDARD directly.
Like in CMakeLists.txt:646
-if(NOT MSVC)
+if (MSVC)
+   set(CMAKE_CXX_STANDARD 11)
+else()

Since I cannot test for MSVC, it is untested.

Kornel


pgpGK_2rdgEf1.pgp
Description: Digitale Signatur von OpenPGP
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: SIGSEGV on current master when saving with cursor in subscript

2024-04-16 Thread Jean-Marc Lasgouttes

Le 13/04/2024 à 08:10, Jürgen Spitzmüller a écrit :

Note that this is not specific to this particularly inset. I can
reproduce with any other (text) inset, e.g.:

1. Start a new document.
2. Insert a Note inset
3. Save the (new) file (cursor still being in the Note inset).

=> Kaboom.


What happens is that Save As... reloads the buffer (for a reason that is 
not very clear at this point), which means that all cursors hold bad 
pointers. It seems that, before the biginset branch removed a few full 
metrics updates, we could get away with it (presumably some code 
somewhere fixes the cursors). Now, we have to fix it at the right place.


I propose the following patch. Can you check that it works?

JMarc


From 3b51ab67228f1014432b99ac2037871bc45e1feb Mon Sep 17 00:00:00 2001
From: Jean-Marc Lasgouttes 
Date: Tue, 16 Apr 2024 11:45:09 +0200
Subject: [PATCH] Sanitize cursors after a buffer has been reloaded

When a buffer is reloaded, its content may remain the same, but the
memory allocation is new, so that the inset pointers in cursors are
now wrong. This requires to sanitize the cursors held by the buffer
views.

Before the biginset branch, some full metrics computation call that is
now removed probably did that as a side effect. Now we have to be more
precise.

To this effect, introduce WorkAreaManager::sanitizeCursors() and use
it in Buffer::reload().
---
 src/Buffer.cpp|  2 ++
 src/frontends/WorkArea.h  |  7 +++
 src/frontends/WorkAreaManager.cpp | 10 ++
 src/frontends/WorkAreaManager.h   |  2 ++
 src/frontends/qt/GuiWorkArea.h|  4 ++--
 5 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/src/Buffer.cpp b/src/Buffer.cpp
index bbe4d80589..c9d6818df6 100644
--- a/src/Buffer.cpp
+++ b/src/Buffer.cpp
@@ -5562,6 +5562,8 @@ Buffer::ReadStatus Buffer::reload()
 	Buffer const * oldparent = d->parent();
 	d->setParent(nullptr);
 	ReadStatus const status = loadLyXFile();
+	// The inset members in cursors held by buffer views are now wrong.
+	workAreaManager().sanitizeCursors();
 	setBusy(false);
 	if (status == ReadSuccess) {
 		updateBuffer();
diff --git a/src/frontends/WorkArea.h b/src/frontends/WorkArea.h
index d6912fc7fa..c0e673554a 100644
--- a/src/frontends/WorkArea.h
+++ b/src/frontends/WorkArea.h
@@ -18,6 +18,8 @@
 
 namespace lyx {
 
+class BufferView;
+
 namespace frontend {
 
 /**
@@ -40,6 +42,11 @@ public:
 
 	/// Update window titles of all users.
 	virtual void updateWindowTitle() = 0;
+
+	///
+	virtual BufferView & bufferView() = 0;
+	///
+	virtual BufferView const & bufferView() const = 0;
 };
 
 } // namespace frontend
diff --git a/src/frontends/WorkAreaManager.cpp b/src/frontends/WorkAreaManager.cpp
index 8d32c6b6d8..ed01be8997 100644
--- a/src/frontends/WorkAreaManager.cpp
+++ b/src/frontends/WorkAreaManager.cpp
@@ -13,6 +13,9 @@
 
 #include "WorkAreaManager.h"
 
+#include "BufferView.h"
+#include "Cursor.h"
+
 #include "Application.h"
 #include "WorkArea.h"
 
@@ -69,6 +72,13 @@ void WorkAreaManager::scheduleRedraw()
 }
 
 
+void WorkAreaManager::sanitizeCursors()
+{
+	for (WorkArea * wa : work_areas_)
+		wa->bufferView().cursor().sanitize();
+}
+
+
 } // namespace frontend
 } // namespace lyx
 
diff --git a/src/frontends/WorkAreaManager.h b/src/frontends/WorkAreaManager.h
index 94c528b3a6..73548592fa 100644
--- a/src/frontends/WorkAreaManager.h
+++ b/src/frontends/WorkAreaManager.h
@@ -49,6 +49,8 @@ public:
 	/// If there is no work area, create a new one in the current view using the
 	/// buffer buf. Returns false if not possible.
 	bool unhide(Buffer * buf) const;
+	/// Fix cursors in all buffer views held by work areas.
+	void sanitizeCursors();
 
 private:
 	typedef std::list::iterator iterator;
diff --git a/src/frontends/qt/GuiWorkArea.h b/src/frontends/qt/GuiWorkArea.h
index 148b79b73a..86bbfda939 100644
--- a/src/frontends/qt/GuiWorkArea.h
+++ b/src/frontends/qt/GuiWorkArea.h
@@ -59,9 +59,9 @@ public:
 	/// is GuiView in fullscreen mode?
 	bool isFullScreen() const;
 	///
-	BufferView & bufferView();
+	BufferView & bufferView() override;
 	///
-	BufferView const & bufferView() const;
+	BufferView const & bufferView() const override;
 	///
 	void scheduleRedraw(bool update_metrics) override;
 
-- 
2.40.1

-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel