Author Topic: page-left command not orthogonal with page-right  (Read 3377 times)

Steve Black

  • Community Member
  • Posts: 57
  • Hero Points: 4
page-left command not orthogonal with page-right
« on: April 04, 2007, 02:18:59 pm »
I just bound page-right and page-left to keys and they are not working in sync with each other.  Help for both commands says they move the cursor half the width of the window.  This is true for page-down, but page-up moves much further.  I.E. if I am at the beginning of a line and I page-right 20 times, it only takes three page-left's to get back to the beginning.

As an enhancement, it would be nice if the scroll amount were parameterized.  I'd rather move a full page-width, to be logically orthogonal with page-up/down.

Steve Black

  • Community Member
  • Posts: 57
  • Hero Points: 4
Re: page-left command not orthogonal with page-right
« Reply #1 on: April 04, 2007, 09:15:37 pm »
Actually, on closer examination, page-left & page-right are both a little badly behaved as compared to their documented functions.

page-right repositions the buffer to the right by slightly more than half its width and repositions the cursor to the right in a seemingly inconsistent manner I can't quite describe.  (I think it is moving relative to the buffer rather than relative to the window as I expected.  After a few moves it gets to the right edge of the window and stays there.)  page-left moves the buffer by leaps and bounds and leaves the cursor more or less in place relative to the window until the last move.

Perhaps I just don't understand how they are supposed to work, or perhaps it's been a very long time since anyone actually used these commands.

All I wanted to do was move the buffer one page to the right/left with the cursor in the same window-relative position with a keystroke.  Is there another way to accomplish this?  (Other than the scroll bar, that is?)

Steve Black

  • Community Member
  • Posts: 57
  • Hero Points: 4
Re: page-left command not orthogonal with page-right
« Reply #2 on: April 05, 2007, 04:40:49 pm »
Specific scenarios.

1) Fixed font, window 117 cols, left-edge col 1, cursor col 1:
    page-right: left-edge col 59(+58), cursor col  71(+70)
    page-right: left-edge col 117(+59), cursor col 225(+154)
    page-right: left-edge col 176(+59), cursor col 292(+67)
    page-right: left-edge col 235(+59), cursor col 351(+59)
    page-right: left-edge col 294(+59), cursor col 410(+59)
    page-right(x10): left-edge col 884(+59x10), cursor col 1000(+590x10)
    page-left: left-edge 420(-464), cursor col 536(-464)
    page-left: left-edge 1(-419), cursor col 59(-)
    page-left: left-edge 1(-0), cursor col 1(-58)

2) Fixed font, window 117 cols, left-edge col 1, cursor col 1:
    page-right(x30): left-edge 1769(+1769), cursor col 1885(+1884) (consistent w/ above)
    page-left: left-edge 1305(-464), cursor col 1421(-464)
    page-left: left-edge 841(-464), cursor col 957(-464)
    page-left: left-edge 377(-464), cursor col 493(-464)
    page-left: left-edge 1(-376), cursor col 59(-434)
    page-left: left-edge 1(-0), cursor col 1(-59)

Steve Black

  • Community Member
  • Posts: 57
  • Hero Points: 4
Re: page-left command not orthogonal with page-right
« Reply #3 on: April 05, 2007, 05:18:05 pm »
The following changes in mouse.e seem to deliver the behavior I'm looking for.  I'm not sure what the impact will be in variable font scenarios.  Further input is certainly welcome.

BTW, how does one give one's self hero points?   ;D

page_right()
      //@scb p_cursor_x=cursor_x*p_font_width;
      p_cursor_x=cursor_x;                                              //@scb

page_left()
      //@scb width=(p_char_width intdiv 2) *p_font_width;
      width=(p_char_width intdiv 2);                                    //@scb

      //@scb cursor_x=cursor_x-width;
      cursor_x=cursor_x-width * p_font_width;                           //@scb

Phil Barila

  • Senior Community Member
  • Posts: 746
  • Hero Points: 61
Re: page-left command not orthogonal with page-right
« Reply #4 on: April 05, 2007, 11:47:55 pm »
Ah, I'll give you one, just because I'm feeling magnanimous, since Dennis says that he's fixed my Build window issue.   :D

Steve Black

  • Community Member
  • Posts: 57
  • Hero Points: 4
Re: page-left command not orthogonal with page-right
« Reply #5 on: April 06, 2007, 01:44:32 am »
Right back at ya man!

And congrats on the Build window too.

 ;)