Hi again,
with the attached ("heuristic") patch I fixed this problem, which was
arising when searching for stuff inside a math environment nested inside
a table cell (i.e., searching for a+b inside Math.lyx). In such
segments, I'm assuming the direction is Left To Right (but don't
actually know if in those countries maths are also left-to-right, or if
they are heels under kneels).
T.
Tommaso Cucinotta ha scritto:
Hi all,
could anyone please explain what is the purpose of the "- 2", in this
method (from InsetTabular.cpp) ?
5090 bool InsetTabular::isRightToLeft(Cursor & cur) const
5091 {
5092 LASSERT(cur.depth() > 1, /**/);
5093 Paragraph const & parentpar = cur[cur.depth() -
2].paragraph();
5094 pos_type const parentpos = cur[cur.depth() - 2].pos();
5095 return parentpar.getFontSettings(buffer().params(),
5096 parentpos).language()->rightToLeft();
5097 }
I get a stdlib assertion when trying to put the cursor at
inset: 0x3378a60 idx: 0 par: 82 pos: 0
inset: 0x34cdf60 idx: 4 par: 0 pos: 10
in Math.lyx (I frozed a version of this file at
http://feanor.sssup.it/~tommaso/Math.lyx), and the troublesome line is
the 5093, inside the paragraph() method (despite the LASSERT()). Full
backtrace follows. AFAICS, the cursor position where I'm trying to
move is legal.
Thanks, bye,
T.
(gdb) bt
#0
std::__debug::vector<__gnu_debug::_Safe_iterator<std::__norm::_List_iterator<lyx::Paragraph>,
std::__debug::list<lyx::Paragraph, std::allocator<lyx::Paragraph> > >,
std::allocator<__gnu_debug::_Safe_iterator<std::__norm::_List_iterator<lyx::Paragraph>,
std::__debug::list<lyx::Paragraph, std::allocator<lyx::Paragraph> > >
> >::operator[] (this=0x28, __n=0) at
/usr/include/c++/4.3/bits/stl_vector.h:485
#1 0x000000000051ad18 in lyx::CursorSlice::paragraph (this=<value
optimized out>) at support/RandomAccessList.h:161
#2 0x00000000008ecd4c in lyx::InsetTabular::isRightToLeft
(this=0x2c80800, c...@0x32aa5c8) at insets/InsetTabular.cpp:5093
#3 0x00000000008ecdf0 in lyx::InsetTabular::edit (this=0x2c80800,
c...@0x32aa5c8, front=true) at insets/InsetTabular.cpp:3305
#4 0x00000000006c8963 in lyx::BufferView::setCursor (this=0x32aa0f0,
d...@0x7fff9865b7e0) at BufferView.cpp:1890
#5 0x00000000006d03e9 in lyx::BufferView::putSelectionAt
(this=0x32aa0f0, c...@0x7fff9865b7e0, length=4, backwards=false) at
BufferView.cpp:1968
#6 0x000000000074bd25 in lyx::findAdv (bv=0x32aa0f0,
o...@0x7fff9865bba0) at lyxfind.cpp:1070
#7 0x000000000074c28e in lyx::findAdv (bv=0x32aa0f0, ev=<value
optimized out>) at lyxfind.cpp:1092
#8 0x00000000006d214b in lyx::BufferView::dispatch (this=0x32aa0f0,
c...@0x7fff9865e3f0) at BufferView.cpp:1262
#9 0x00000000005cc58b in lyx::LyXFunc::dispatch (this=0x1a165f0,
c...@0x7fff9865e3f0) at LyXFunc.cpp:1678
#10 0x00000000005a6999 in lyx::dispatch (acti...@0x7fff9865e3f0) at
LyX.cpp:1156
#11 0x00000000009e5cff in
lyx::frontend::FindAndReplaceWidget::findAndReplace (this=0x2b1e590,
casesensitive=<value optimized out>,
matchword=<value optimized out>, backwards=false,
expandmacros=false, ignoreformat=<value optimized out>, replace=false)
at FindAndReplace.cpp:141
#12 0x00000000009e613d in
lyx::frontend::FindAndReplaceWidget::findAndReplace (this=0x2b1e590,
backwards=false, replace=false) at FindAndReplace.cpp:158
#13 0x00000000009e61e1 in
lyx::frontend::FindAndReplaceWidget::on_findNextPB_clicked (this=0x28)
at FindAndReplace.cpp:188
#14 0x00000000009e63e1 in
lyx::frontend::FindAndReplaceWidget::eventFilter (this=0x2b1e590,
obj=0x2b24f80, event=0x7fff9865eba0) at FindAndReplace.cpp:73
#15 0x00007f778f038a68 in
QCoreApplicationPrivate::sendThroughObjectEventFilters () from
/usr/lib/libQtCore.so.4
#16 0x00007f778f50775c in QApplicationPrivate::notify_helper () from
/usr/lib/libQtGui.so.4
#17 0x00007f778f5108bf in QApplication::notify () from
/usr/lib/libQtGui.so.4
#18 0x0000000000953b53 in lyx::frontend::GuiApplication::notify
(this=0x28, receiver=0x0, event=0xcc2f70) at GuiApplication.cpp:1303
#19 0x00007f778f03975c in QCoreApplication::notifyInternal () from
/usr/lib/libQtCore.so.4
#20 0x00007f778f59c6b4 in ?? () from /usr/lib/libQtGui.so.4
#21 0x00007f778f59ea12 in ?? () from /usr/lib/libQtGui.so.4
#22 0x00007f778f5775bd in QApplication::x11ProcessEvent () from
/usr/lib/libQtGui.so.4
#23 0x00007f778f5a0464 in ?? () from /usr/lib/libQtGui.so.4
#24 0x00007f778cce620a in g_main_context_dispatch () from
/usr/lib/libglib-2.0.so.0
#25 0x00007f778cce98e0 in ?? () from /usr/lib/libglib-2.0.so.0
#26 0x00007f778cce9a7c in g_main_context_iteration () from
/usr/lib/libglib-2.0.so.0
#27 0x00007f778f062e6f in QEventDispatcherGlib::processEvents () from
/usr/lib/libQtCore.so.4
#28 0x00007f778f59fbef in ?? () from /usr/lib/libQtGui.so.4
#29 0x00007f778f038002 in QEventLoop::processEvents () from
/usr/lib/libQtCore.so.4
#30 0x00007f778f0383cd in QEventLoop::exec () from
/usr/lib/libQtCore.so.4
#31 0x00007f778f03a694 in QCoreApplication::exec () from
/usr/lib/libQtCore.so.4
#32 0x00000000009526bd in lyx::frontend::GuiApplication::exec
(this=0x1a165c0) at GuiApplication.cpp:1096
#33 0x00000000005b0a68 in lyx::LyX::exec (this=0x7fff986625a0,
ar...@0x7fff9866259c, argv=<value optimized out>) at LyX.cpp:359
#34 0x000000000043bde3 in main (argc=2, argv=0x7fff98662698) at
main.cpp:46
--
Tommaso Cucinotta, Computer Engineering PhD, Researcher
ReTiS Lab, Scuola Superiore Sant'Anna, Pisa, Italy
Tel +39 050 882 024, Fax +39 050 882 003
http://feanor.sssup.it/~tommaso
Index: src/insets/InsetTabular.cpp
===================================================================
--- src/insets/InsetTabular.cpp (revisione 30780)
+++ src/insets/InsetTabular.cpp (copia locale)
@@ -5090,6 +5090,8 @@
bool InsetTabular::isRightToLeft(Cursor & cur) const
{
LASSERT(cur.depth() > 1, /**/);
+ if (cur[cur.depth() - 2].inset().inMathed())
+ return false;
Paragraph const & parentpar = cur[cur.depth() - 2].paragraph();
pos_type const parentpos = cur[cur.depth() - 2].pos();
return parentpar.getFontSettings(buffer().params(),