On Thu, Dec 27, 2018 at 07:56:23PM -0500, Scott Kostyshak wrote:
> On Thu, Dec 27, 2018 at 01:22:16PM +0100, Jürgen Spitzmüller wrote:
> > Am Donnerstag, den 27.12.2018, 12:57 +0100 schrieb Kornel Benko:
> > > Only crashes if opened rw here (e.g. not from Help menu)
> > 
> > That's what I did as well (open rw).
> 
> I can reproduce. I'll look into it.

Attached is a patch. It seems that the problem is:

  bool const in_last_par = (it.pit() == cur.selectionEnd().pit());

Apparently this doesn't always do what I thought it did. Replacing it
with

  bool const in_last_par = (&it.paragraph() == &cur.selectionEnd().paragraph());

seems to avoid the assertion (because then "end" is set correctly), but
I don't feel comfortable not knowing why the original in_last_par
definition doesn't work. Is it possible that different paragraphs can
have the same pit?

I have a fundamental misunderstanding somewhere, but not sure where.

Scott
diff --git a/src/Text3.cpp b/src/Text3.cpp
index 7b8f2f9a2a..d125c64485 100644
--- a/src/Text3.cpp
+++ b/src/Text3.cpp
@@ -3233,7 +3233,7 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
 			for (DocIterator it = cur.selectionBegin(); ; it.forwardPar()) {
 				pos_type const beg = it.pos();
 				pos_type end;
-				bool const in_last_par = (it.pit() == cur.selectionEnd().pit());
+				bool const in_last_par = (&it.paragraph() == &cur.selectionEnd().paragraph());
 				if (in_last_par)
 					end = cur.selectionEnd().pos();
 				else

Attachment: signature.asc
Description: PGP signature

Reply via email to