Author Topic: Keep line with cursor vertically centered  (Read 537 times)

Offline S.H.Bouwhuis

  • Registered User
  • Newbie
  • *
  • Posts: 17
  • Karma: +0/-0
    • View Profile
Keep line with cursor vertically centered
« on: April 19, 2017, 10:29:54 pm »
Is it already possible, or could it be added that you can set when the text scrolls up or down depending on the position of the cursor? Currently the text scrolls only when your cursor is at the top or bottom line.
So, let's say I set it to 10 lines, then whenever I get closer than 10 lines from the top or bottom, the text would scroll.

I specifically would like to set the option to a high value, so that the line with the cursor in it will stay in the center of the window.

Also, for programming I like a 2 to 1 split. So, the line with the cursor is always at 2/3 of the screen. (I can look ahead 1/3 screen, and look back 2/3 screen).

PS
If possible, also in HEX mode.

Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2181
  • Karma: +37/-3
    • View Profile
    • HippoEDIT
Re: Keep line with cursor vertically centered
« Reply #1 on: April 19, 2017, 11:54:48 pm »
Hi Sander,

you can configure cursor offsets to window edges using following XML flags:
http://wiki.hippoedit.com/options/xml/view-offset
but only in absolute numbers (in lines). You can not set it to the percentage of the screen lines.

It is not possible yet in Hex mode, but I will note it and would have in the first version. Probably reusing offsets from the text editor.

BR, Alex.

Offline S.H.Bouwhuis

  • Registered User
  • Newbie
  • *
  • Posts: 17
  • Karma: +0/-0
    • View Profile
Re: Keep line with cursor vertically centered
« Reply #2 on: April 20, 2017, 04:56:09 pm »
Aha, that's great!

Are the offsets uint8? Or bigger?
For safety I've set them like this:

Code: [Select]
<Source_Editor>
  <TopYOffset>255</TopYOffset>
  <BottomYOffset>255</BottomYOffset>
  <LeftXOffset>10</LeftXOffset>
  <RightXOffset>10</RightXOffset>
<Source_Editor>

Edit 1:
Hmmm... I must be doing something wrong, because strange things are happening.
Aren't you checking the bounds? My cursor goes off screen.

Edit 2:
Yes, it seems you're not checking the bounds. When the TopYOffset en BottomYOffset overlap you have to do the smart thing and center the cursor. Now you seem to let TopYOffset take precedence when scrolling down.
« Last Edit: April 20, 2017, 05:09:23 pm by S.H.Bouwhuis »

Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2181
  • Karma: +37/-3
    • View Profile
    • HippoEDIT
Re: Keep line with cursor vertically centered
« Reply #3 on: April 20, 2017, 06:39:49 pm »
Hi Sander,

HE is a software for professionals - ones who will respect the screen line count :)
The offset is in lines, not in pixels ;) I doubt that you have 500 lines visible on the screen.

But, yes you are right. Bounds should be checked. I will fix it in next build.
From another side, as you suggest, this is a way to detect mode to use normalization of the offsets, in case of screen size overflow - this will allow coming to proportional split of the cursor position: so, if you set Top 1000 and bottom to 500 it would mean the cursor will be always on 2/3 of the screen and it will scroll up or down as you go up/down one line.

As temporary workaround use lower numbers ;)

BR, Alex.

Offline S.H.Bouwhuis

  • Registered User
  • Newbie
  • *
  • Posts: 17
  • Karma: +0/-0
    • View Profile
Re: Keep line with cursor vertically centered
« Reply #4 on: April 20, 2017, 10:49:57 pm »
Ha ha ha, being a software engineer myself I understand what you are saying.
I just want to help improve HippoEdit to become one of the best editors out there. Good for you, and good for the users.

 

Related Topics

  Subject / Started by Replies Last post
7 Replies
2853 Views
Last post March 06, 2009, 07:04:25 pm
by alex
1 Replies
2476 Views
Last post April 18, 2009, 09:19:53 pm
by alex
change cursor?

Started by theapostle General Discussion

2 Replies
1788 Views
Last post January 24, 2010, 12:06:42 am
by alex
1 Replies
2086 Views
Last post October 21, 2010, 02:22:24 pm
by alex
2 Replies
1846 Views
Last post November 19, 2010, 03:53:45 pm
by scunliffe