On Sat, Feb 25, 2017 at 12:37:18PM -0500, Richard Heck wrote:
> On 02/25/2017 08:22 AM, Enrico Forestieri wrote:
> > On Thu, Jan 26, 2017 at 11:11:32AM +0000, Guenter Milde wrote:
> >> On 2017-01-25, Enrico Forestieri wrote:
> >>> On Wed, Jan 25, 2017 at 08:50:21PM +0000, Guenter Milde wrote:
> >>>> On 2017-01-25, Enrico Forestieri wrote:
> >>>>> On Tue, Jan 24, 2017 at 09:11:12PM +0100, Enrico Forestieri wrote:
> >>>>>> On Tue, Jan 24, 2017 at 12:00:02PM +0000, Guenter Milde wrote:
> >>>>>>> On 2017-01-24, Enrico Forestieri wrote:
> >> ...
> >>
> >>>>>>>> 1) start a new document and input "--" and you get \textendash
> >>>>>>>> 2) now enter another "-" and you get \textemdash
> >>>>>>>> 3) now enter another "-" and everything gets replaced by "-"
> >> ...
> >>>>> The attached patch corrects this glitch and I am going to commit it
> >>>>> because I really don't see any rationale behind this behavior.
> >>>> With your patch, would pressing the [-]-Key 4 times become 
> >>>> EM DASH + HYPHEN or ----?
> >>> ----   becomes EM DASH + HYPHEN
> >>> -----  becomes EM DASH + EN DASH
> >>> ------ becomes EM DASH + EM DASH
> >>> and so on. 
> >> So this is reproducing the behaviour you get with LaTeX ligatures.
> >>
> >> +1 for this patch.
> > I committed it at 3c329db0.
> >
> > Richard, this is also needed in stable.
> 
> OK.

Done at 857548d3.

Note that I need the attached patch to be able to compile stable with
Qt 5.8, otherwise I get the following error:

../../../../src/frontends/qt4/GuiViewSource.cpp: In member function ‘void 
lyx::frontend::ViewSourceWidget::realUpdateView()’:
../../../../src/frontends/qt4/GuiViewSource.cpp:229:14: error: ambiguous 
overload for ‘operator!=’ (operand types are ‘const QChar’ and ‘char’)
   while (*oc != '\0' && *nc != '\0' && *oc == *nc) {
              ^


Then, a decision has to still be taken as regards the original problem
in this thread. I think that the patch Günther proposed on Jan. 25 is
the less controversial one.

-- 
Enrico
diff --git a/src/frontends/qt4/GuiViewSource.cpp 
b/src/frontends/qt4/GuiViewSource.cpp
index 660da59..a4f67ed 100644
--- a/src/frontends/qt4/GuiViewSource.cpp
+++ b/src/frontends/qt4/GuiViewSource.cpp
@@ -226,7 +226,7 @@ void ViewSourceWidget::realUpdateView()
                const QChar * oc = old.constData();
                const QChar * nc = qcontent.constData();
                int pos = 0;
-               while (*oc != '\0' && *nc != '\0' && *oc == *nc) {
+               while (*oc != 0 && *nc != 0 && *oc == *nc) {
                        ++oc;
                        ++nc;
                        ++pos;

Reply via email to