GNOME Bugzilla – Bug 702075
Moving the caret cursor between lines is confusing
Last modified: 2013-06-26 16:18:56 UTC
When moving the previous line the cursor is positioned at the end of the line and moving to the next line places the cursor at the beginning of the line. This is very confusing, we should keep the line offset and try to keep it when moving between lines.
Created attachment 247190 [details] [review] Keep the offset when moving between lines
Review of attachment 247190 [details] [review]: This works much better but it's still not consistent with other apps. With this patch the current offset is always used as line offset, so that if you move to a line shorter than the current line, the clamped offset (current line length) is used as the line offset when moving to another line. What we want is to keep a global line offset that is only updated when the cursor is moved horizontally, and it's always used when moving vertically. You can check this behaviour with gedit or libreoffice.
Created attachment 247264 [details] [review] Keep the offset when moving between lines Patch updated according to comments in comment 2.
Created attachment 247838 [details] [review] Keep the cursor x coordinate when moving between lines The previous patch kept the cursor_offset when moving between lines, but as the bounding box sizes are quite different depending on the character, the caret still oscillates too much. The current patch keeps, instead of the cursor_offset, the x coordinate of the cursor (in terms of view coordinates) and positions the caret in character of the corresponding line closer to that x coordinate.
Comment on attachment 247838 [details] [review] Keep the cursor x coordinate when moving between lines Pushed to git master, thanks!