Bug 38884 - Improve Up/Down movement in writer
Summary: Improve Up/Down movement in writer
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: Other All
: medium normal
Assignee: Juergen Funk (CIB)
URL:
Whiteboard: target:4.4.0 target:7.2.0 target:7.1.3
Keywords: difficultyInteresting, easyHack, skillCpp, topicUI
Depends on:
Blocks:
 
Reported: 2011-07-01 07:09 UTC by Björn Michaelsen
Modified: 2021-03-18 08:56 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Björn Michaelsen 2011-07-01 07:09:43 UTC
Improve Up/Down movement

Background: Up and down movement of the visual caret is currently done by looping over the coordinates of all caret positions. Then the caret position with the closest coordinate in the direction of movement is chosen. That is when moving downwards (hitting the arrow down key) the caret position with the closet coordinate below the coordinate of the current caret position is chosen as the next caret position. However, to avoid jump to the left and right like crazy a heuristic function is applied to the distance, so that dx imposes more penalty than dy, for down movement. Current heuristic is just a more or less random choice, so this could definitively be improved. The code is in SmCursor::Move, any improvement of the behavior would be welcome. In the long run it might also be interesting to consider fontsize, scale and other things that might have impact on the coordinates. This task is probably best solved through trial and error. If you try a lot of solutions please write them down, and note your results so we can discuss them... The code for this task is very isolated, and it shouldn't be hard to find a better solution, but a near flawless solution is probably very hard and not needed, any improvement is welcome.

Skills: Building, C++
Comment 1 Forest Johnson 2011-11-28 21:56:58 UTC
Is this just for normal text in writer? Why is this even an issue? I was under the impression that this was for special equation notation cursors, but It doesn't even look like there is a cursor that moves up and down when you are writing equations.
Comment 2 Noel Grandin 2011-11-29 03:38:05 UTC
The only SmCursor::Move method is in the starmath module, here:

http://opengrok.libreoffice.org/xref/core/starmath/source/cursor.cxx#36
Comment 3 Florian Reisinger 2012-05-18 09:01:44 UTC
Deteted "Easyhack" from summary
Comment 4 Björn Michaelsen 2013-10-04 18:46:49 UTC
adding LibreOffice developer list as CC to unresolved EasyHacks for better visibility.

see e.g. http://nabble.documentfoundation.org/minutes-of-ESC-call-td4076214.html for details
Comment 5 Michal Strnad 2014-03-19 10:12:57 UTC
Hello,

I am starting work on this bug.
Comment 6 Juergen Funk (CIB) 2014-09-12 10:29:46 UTC
I think the right behavior is the start postion. When move down i expect that the caret is on the same postion. But when a line is shorter then he jump to the end of this line (jump left). When the follow line is longer the position is where i started (jump right). But in this case the caret jump left and right, but i think the positon is importent point. 
That is the behavior of WORD, maybe i a little bit MS contaminated.
Comment 7 Juergen Funk (CIB) 2014-09-15 08:25:30 UTC
Hi Michal Strnad,

i would like do fix this bug look to my "Comment 6". 
Do you have a problem with that?
Comment 8 Juergen Funk (CIB) 2014-09-18 08:22:31 UTC
Checkin in Master https://gerrit.libreoffice.org/#/c/11500/

My first checkin i hope it is okay.

The main problem is after the cursor down get a event from i don't know but in the stack i see 

- swlo.dll!SwCrsrShell::UpdateCrsr
.
.
- sfxlo.dll!SfxObjectShell::FlushDocInfo
.
.
- swlo.dll!SfxStubSwViewStateStatusLine
.
.
- sfxlo.dll!SfxBindings::LinkStubNextJob_Impl

i am not sure is that needed to update the cursor, without this event my fix is not necessary?

The next i have see is 
ActionPend() && BasicActionPend()
when ActionPend = TRUE  the BasicActionPend is TRUE too
when ActionPend = FALSE the BasicActionPend is FALSE too

The BasicActionPend is not needed!?


The change in crstrvl.cxx is only for the consistency
Comment 9 Adolfo Jayme Barrientos 2014-09-19 06:58:25 UTC
Hi Juergen, welcome to the LibreOffice community! We hope you enjoy your stay :-)

I’m marking this bug “ASSIGNED”, and when your patch is accepted into the core repository, we can change the status to “FIXED”. Thanks for your contribution!
Comment 10 Commit Notification 2014-09-22 08:04:09 UTC
Juergen Funk committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=d58bea0ffa2a2fe79103ab7aa743aea63e27a0fd

Fix fdo#38884 Improve Up/Down movement in writer



The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 11 Commit Notification 2014-09-30 14:15:14 UTC
Juergen Funk committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=e98e9fda34736731e4c539b1799abb4257219988

fdo#38884 Fix setting X position with dbgutil enabled



The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 12 Robinson Tryon (qubit) 2015-12-16 00:38:31 UTC
Migrating Whiteboard tags to Keywords: (EasyHack DifficultyInteresting SkillCpp TopicUi )
[NinjaEdit]
Comment 13 Robinson Tryon (qubit) 2016-02-18 16:37:15 UTC
Remove LibreOffice Dev List from CC on EasyHacks
(curtailing excessive email to list)
[NinjaEdit]
Comment 14 Commit Notification 2021-03-05 18:45:48 UTC
Xisco Fauli committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/ee0f845b3d739a6109f08d5c0cd0d839100f6828

tdf#93441: Revert "Fix fdo#38884 Improve Up/Down movement in writer"

It will be available in 7.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 15 Commit Notification 2021-03-18 08:56:19 UTC
Xisco Fauli committed a patch related to this issue.
It has been pushed to "libreoffice-7-1":

https://git.libreoffice.org/core/commit/28757ce2246f2598c8ace45f87225eaabbdaf8f0

tdf#93441: Revert "Fix fdo#38884 Improve Up/Down movement in writer"

It will be available in 7.1.3.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.