Hello Jean-Marc,

> +++ b/src/Cursor.cpp
>  <at>  <at>  -278,7 +278,7  <at>  <at>  CursorData::CursorData(DocIterator
const & dit)
>   // bv functions are not yet available!
>   Cursor::Cursor(BufferView & bv)
>          : CursorData(&bv.buffer()), bv_(&bv),
> -         x_target_(-1), textTargetOffset_(0)
> +         x_target_(-1), textTargetOffset_(0),left_edge_(0)
>   {}
> 
> Didn't you forget too_wide_row_?
> 
>  <at>  <at>  -538,7 +538,33  <at>  <at>  Row const & Cursor::textRow() const
>   {
>          CursorSlice const & cs = innerTextSlice();
>          ParagraphMetrics const & pm = bv().parMetrics(cs.text(), cs.pit());
> -       return pm.getRow(pos(), boundary());
> +       bool const bndry = inTexted() ? boundary() : false;
> +       return pm.getRow(cs.pos(), bndry);
> +}
> +
> +int Cursor::getLeftEdge() const
> +{
> +       return left_edge_;
> +}
> +
> +Row const & Cursor::getToowideRow()
> +{
> +       return *too_wide_row_;
> +}
> 
> As I already said, I think this name is not good. I would propose 
> current_row_ or current_bottpm_row_. THe question is not to know whether 
> the row is to wide, but what is the row to which the value of left_edge 
> makes reference.

What I thought from the beginning is to save the finally found actual too
wide row to this variable. So until we find a too wide row, we cannot save
something to this. That is why I have not initialized too_wide_row in the
constructor of Cursor. So in that case we have to identify a wide row in
TextMetrics.cpp and save the value from there.

That is what I have tried in this commit:
http://git.lyx.org/?p=gsoc.git;a=commitdiff;h=5ac5e4cd540eb3b9ca9e06dd14aef63d4361b37a
But unexpectedly it stops by giving a runtime error at a point we need to
slide a row. After some debugging I hope the error is within setToowideRow()
method.

As I can see, what you are expecting it save the current row to this
variable and always / just after visiting a wide row; set the left_edge to
0. I will try this approach too.


> +
> +void Cursor::setLeftEdge(int leftEdge)
> +{
> +       left_edge_ = leftEdge;
> +}
> +
> +void Cursor::setLeftEdge(int leftEdge) const
> +{
> +       const_cast<Cursor *>(this)->setLeftEdge(leftEdge);
> +}
> 
> When you have to do something like this, then something is usually 
> wrong. I think it would be better to make a cast the cursor to an 
> unconstified version in drawParagraphs that to create const methods that 
> are not const. This is just cheating.

Yes, I will try that too.

> 
>          // check if we had something else in mind, if not, this is the 
> future
>          // target
> -       if (x_target_ == -1)
> +       if (x_target_ == -1){
>                  setTargetX(xo);
> +               left_edge_=0;
> +       }
>          else if (inset().asInsetText() && xo - textTargetOffset() != 
> x_target()) {
>                  // In text mode inside the line (not left or right) 
> possibly set a new target_x,
>                  // but only if we are somewhere else than the previous 
> target-offset.
>  <at>  <at>  -1981,8 +2018,10  <at>  <at>  bool Cursor::upDownInText(bool
up, bool & 
> updateNeeded)
>          // update the targetX - this is here before the "return false"
>          // to set a new target which can be used by InsetTexts above
>          // if we cannot move up/down inside this inset anymore
> -       if (x_target_ == -1)
> +       if (x_target_ == -1){
>                  setTargetX(xo);
> +               left_edge_=0;
> +       }
> 
> Are you sure that this one is needed? What is the use case?

I was not sure whether the text can go grow beyond the screen limits.
Because of that reason I added this here. According to the new update to the
algorithm (stated above), I think I can remove these two lines. Is not it?

Thank you
Hashini






Reply via email to