I suspect this is not going to work when you want to set cursor by mouse on a 
slided row. I think the offset information shall be in bufferview as Richard 
said.

JMarc


Hashini Senaratne <hashz1...@gmail.com> a écrit :

>Thank you for this information; Jean-Marc Lasgouttes & Richard
>
>> > Yes, only the visible cursor point is not at the correct place. I
>can delete
>> > or add characters to where I expect.
>> > Is this blink code is in Cursor.cpp or somewhere related to
>graphics? I
>> > tried to find it but failed.
>> > I will try to search more and get the help later if I cannot find a
>clue.
>> 
>> Sorry, look for GuiWorkArea::Private::showCursor() in 
>> src/frontend/qt4/GuiWorkArea.cpp.
>
>I was able to set the cursor by adding some code to the
>GuiWorkArea::Private::showCursor() as follow.
>
>--- a/src/frontends/qt4/GuiWorkArea.cpp
>+++ b/src/frontends/qt4/GuiWorkArea.cpp
>@@ -627,6 +627,16 @@ void GuiWorkArea::Private::showCursor()
>                && !completer_->inlineVisible();
>        cursor_visible_ = true;
>        cursor_->recomputeWidth();
>+
>+       // expansion to show cursor on screen for too long insects
>+       BufferView & bv = cur.bv();
>+       int cur_x=cur.targetX();
>+       int const maxwidth = bv.workWidth();
>+       if (cur_x >= maxwidth)
>+       {
>+               p.x_=maxwidth-5;
>+       }
>+
>        showCursor(p.x_, p.y_, h, l_shape, isrtl, completable);
> }
>
>http://git.lyx.org/?p=gsoc.git;a=commitdiff;h=952a0cdc561f5e2714a080111f80ae526af23fc3
>
>Now we can go along inset like Math without the previous problem. But
>still
>there are a lot to improve and fix.
>
>Discovered problems are:
>
>1) When insert or delete (backspace) any text to a slid Math inset,
>inset
>slides to the left most position. But when continuing with moving the
>cursor
>using arrow keys; cursor starts to slide from the correct position.
>
>2) Try to click within the math inset (in an area that has been slid to
>left) to get the cursor to that position OR try to select a range of
>text
>within the math inset; both will return back to the left most position
>of
>the inset.
>
>3) This implementation does not work for the insets; tables, images and
>labels because cur.targetX() is not changing when the cursor moves
>along them.
>
>4) Still the per row sliding has not been implemented.
>
>5) Go to the right most cursor position along the Math inset in
>changesNeeded.lyx document in Testing Templates. Then press left arrow
>once;
>again the inset slides to the left most position. But correctly
>continue
>from there.
>
>6) Go to the right most cursor position along the Math inset in
>changesNeeded.lyx as above and press the up arrow for once. This is not
>the
>correct position where the cursor should go. Sometimes when trying to
>move
>left; process terminated unexpectedly by giving the error: 
>
>What I personally feel is; that it seems very hard to come up with a
>generic
>solution for all the insets. That is because within different insets,
>attributes seems to have different meanings. So do not you think that,
>what
>I have done so far is most applicable for MathInset and may be we need
>different approaches for images, labels, etc. The current
>implementation of
>the table keyboard sliding is really good and it involves cell numbers
>and a
>different set of attributes related specific to a tabular. If we try to
>implement separately, that is also need not to be changed. 
>
>Is there any way that we can check the inset type where the cursor is
>on; in
>this scope (TextMetrics::drawParagraph(...))?  
>
>CoordCache.cpp (40): break on pointer: 0x3838240 hint: x size: 3
>lassert.cpp
>(43): ASSERTION false VIOLATED IN CoordCache.cpp:41 Assertion triggered
>in
>void lyx::doAssert(const char*, const char*, long int) by failing check
>"false" in file lassert.cpp:45 Buffer.cpp (1356):
>/home/hashini/Desktop/GSoC
>2013/Phase 1/changesNeeded.lyx.emergency Aborted (core dumped)
>
>7) Use of numerical values (5 & 10) in modified code (in void
>GuiWorkArea::Private::showCursor() and
>TextMetrics::drawParagraph(PainterInfo & pi, pit_type pit, int x, int
>y))
>may not be a good approach, as the cursor position may not applicable
>for
>different text sizes. 
>
>I shared my outcomes with all the developers before proceed, to get
>your
>valuable comments and ideas.
>
>Thank you
>Hashini 

Reply via email to