Hello Jean-Marc, > This is why I proposed that the row (or the cursor) remembers the > current offset and only changes it if is is not suitable. See one of my > previous mails.
I think this not-suitability cannot decide only with this offset attribute. As proceeds I figured out that only using the offset value, it is impossible to give a correct output in scrolling. That is, without knowing the amount that we already slid, we cannot take a decision whether to slide the row or not; when the cursor is moving. This amount can vary from time to time. Following are few examples that can take in to account. Consider about an already slid row. *We are going to click on a place which is visible in the current screen (may be from right or left from the current cursor) Note that the implementation that we have in mind, will not have the cursor always at the right edge as in my last test. *We can start selecting a range of content in a Math inset by clicking at a point and and move the mouse further to left and release the mouse. How are we going to know whether we passed the screen limits or not? *Even it can be a situation where the cursor is at a righter part of the content and we are going to re size the screen (actually reduce) such that the cursor tends to disappear from the screen. At such a moment, we need to slide the row such that the cursor appears in the screen. *In the current version of LyX; if we closed a document and re-open it, the cursor appears at the same point where we stopped it. Horizontal scrolling also should support this feature. The solution that I am going to propose it to have an attribute which shows the actual position in pixels of the leftmost edge of the current appearing screen. We actually may not need an offset in this case. We can however compute the offset by: (cur.targetX()- bv.workWidth()) in the drawparagraph() method in TextMetrics.cpp whenever we need. The only problem that I have is how to get this pixel value of the left edge of the screen??? The algorithm would be as simple as follows if we can find that attribute from time to time. Here (screen_width= bv.workWidth()) *if(cur.targetX()>left_edge_Value && cur.targetX()<left_edge_Value+screen_width) then move only the cursor, do not slide row [Selecting an appearing position scenario] *if(cur.targetX()<left_edge_Value) then slide row to right and move the cursor to the right edge [Selecting a range of content with the use of mouse scenario/ reduce the size of the screen from left side] *if(cur.targetX()>left_edge_Value && cur.targetX()<left_edge_Value+screen_width) then move only the cursor, do not slide row [Selecting a range of content with the use of mouse scenario/ reduce the size of the screen from right side] Do not you think that this is a good approach? However we need to consider about changing rows, as you proposed earlier. Is there a technique to find this left_edge_Value (in pixel) in your mind? Thank you Hashini