Author Topic: Panning and Scrolling  (Read 40668 times)

brebey

  • Community Member
  • Posts: 58
  • Hero Points: 2
Panning and Scrolling
« on: April 22, 2008, 10:06:03 PM »
I'm having trouble finding SlickEdit's version of panning.  I have keys assigned to SCROLL a window, which keeps the cursor fixed to whatever character it's on while sliding the buffer around on the screen.

Other editors have "panning" or "view shifting", which is very similar to scrolling, but instead of the cursor moving WITH the buffer, the cursor stays at its current graphical location, and the text slides around under it.

I'm sure Slick has this feature, but I can't find the name of the SlickC function that gets the job done.  I really miss this feature from my other editors, and would like to know how to get Slick to do this. 

Thanks for any help!

Bill Rebey

ScottW, VP of Dev

  • Senior Community Member
  • Posts: 1471
  • Hero Points: 64
Re: Panning and Scrolling
« Reply #1 on: April 23, 2008, 01:55:54 PM »
Actually, I don't think we have a feature that does this, and I'm struggling to see how it is useful. Can you describe how you use this feature and how it saves you time over conventional scrolling? Please be as specific as possible including the key strokes or mouse actions you use when you do this. Also, when do you do this versus regular scrolling or do you use the panning exclusively?

That should help me understand and prioritize any needed changes.  Thanks!

chrisant

  • Senior Community Member
  • Posts: 1410
  • Hero Points: 131
Re: Panning and Scrolling
« Reply #2 on: April 23, 2008, 04:24:18 PM »
I, too, am used to panning.  It's on my list of macros to write, just haven't gotten there yet.  Honestly I don't understand how folks edit source code without panning (see example below).  But, there are two kinds of panning.  I don't know of widely accepted terms for them, so I'll call them both "panning" here:

Style 1:  Shift the file up/down, always adjusting the cursor line as well.  Example, first line in viewing area is 200, cursor line is 201:  pan down once shifts first line to be 201, shifts cursor line to be 202; pan down again shifts first line to be 202, shifts cursor line to be 203.  Pan-up is a no-op when the first line is 1, and pan-down is a no-op when the last line of the file is in the viewing area.

Style 2:  Shift the view up/down, but keep the cursor on the same line of the file (cursor line shifts up/down with the view).  Variations when cursor line reaches the top/bottom of the viewing area:
(2a)  Cursor line shifts out of the viewing area (this is the same as using a scrollbar, you're just doing it with keys instead of with the mouse).
(2b)  What I'm used to:  When cursor line reaches the top/bottom of the viewing area, the file can still shift up/down but the cursor line also moves up/down so that it stays in the viewing area.  Example, first line in viewing area is 200, cursor line is 201:  pan down once shifts first line to be 201, cursor line is still in view so cursor line stays 201; pan down again shifts first line to be 202, cursor line would move out of view so it is also shifted to 202 as well.
(2c)  Can't pan if doing so would move the cursor line out of view (have seen this before, but seems less useful to me).


Answering ScottW's questions:
  • Panning is more precise and predictable than using a scrollbar, plus it is done without your hands leaving the keyboard (see example scenario below).
  • I am used to both scrolling and panning extensively.
  • Some editing programs also make the cursor up/down/left/right keys either scroll or pan while ScrollLock is active (though for me, having to press multiple buttons defeats the simplicity of (2b) above; I prefer to be able to hold one keystroke for a moment and be done, rather than pressing a series of keystrokes in succession).


An example of when I pan:

I am editing near the top of the window, and I want to nudge the scroll position to see more lines above.  My fingers never leave the keyboard, and I press and hold the pan-up key for a quarter second and release when what I wanted to see scrolls into view.  The cursor is still on the same line and column where it was, so if I've overshot by a line or two it doesn't matter.  I continue typing.

Here's the same thing with scrolling:

I am editing near the top of the window, and I want to nudge the scroll position to see more lines above.  I move my hand and put it on the mouse and move the mouse over to the scrollbar.  I can't click above the scroll thumb bar to go up a page, that would scroll the cursor line out of view.  So I click on the scroll thumb bar and drag it a few pixels.  Maybe it's a small file and I need to drag it a hundred pixels.  Or maybe it's a big file and dragging a few pixels already overshot by a hundred lines.  Now I drag back.  Oh forget it, this isn't working.  Hm, should I click on the up/down scroll buttons and try to find where I was and then scroll up?  Don't have time for this, so I'll...

Do the same thing with cursor movement:

Press a cursor movement key to snap the cursor line back into view.  Hold the Up arrow key for a quarter second and release when what I wanted to see scrolls into view.  Hold the Down arrow key until the cursor is back to the starting line.  Oops, released a moment early/late, press Up/Down until the cursor is back on the right line.
« Last Edit: April 23, 2008, 04:30:23 PM by chrisant »

evanratt

  • Senior Community Member
  • Posts: 300
  • Hero Points: 23
Re: Panning and Scrolling
« Reply #3 on: April 23, 2008, 05:30:40 PM »
Doesn't SlickEdit have style 2b that you describe available? I have 'scroll-up' and 'scroll-down' mapped to Alt-Z and Ctrl-Z respectively, and it seems to behave exactly as you describe. I do agree, once I got used to having this available on a key, I can't work without it.

-Evan

chrisant

  • Senior Community Member
  • Posts: 1410
  • Hero Points: 131
Re: Panning and Scrolling
« Reply #4 on: April 23, 2008, 09:14:09 PM »
Woo hoo!  Thanks, Evan, scroll-up and scroll-down do exactly 2b.

hs2

  • Senior Community Member
  • Posts: 2763
  • Hero Points: 292
Re: Panning and Scrolling
« Reply #5 on: April 23, 2008, 09:23:22 PM »
BTW: There are a lot more useful 'scroll-*' commands available. HS2

ScottW, VP of Dev

  • Senior Community Member
  • Posts: 1471
  • Hero Points: 64
Re: Panning and Scrolling
« Reply #6 on: April 24, 2008, 03:01:25 PM »
This thread has become a bit confusing. By my reading, there are two different definitions for the distinction between panning and scrolling:
1) Mechanism: scrolling is using the scroll bar, and panning uses the keyboard.
2) Cursor location: scrolling keeps the cursor on the same line of code while panning keeps the cursor in the same position within the editor window.
3) Hybrid. Insert Spanish Inquisition joke here.

I'd rather not debate the true definition of these terms. Instead, let's look at the behaviors.
1) SlickEdit provides a traditional scroll with the scrollbar. The cursor stays on the same line of code.
2) SlickEdit provides commands to scroll with the keyboard: scroll-up and scroll-down. The cursor stays on the same line of code.
3) SlickEdit provides page-up and page-down. The cursor stays within the edit window. It generally adheres to the same location within the editor window, but depends on whether you have "Click past end of line" on as to whether the column will change. Also, the cursor will go to the top/bottom line of the editor window when you page-up/down on the first/last page of the document. I don't think we have line oriented versions of this.

I think the page-up/page-down behavior matches the original request from brebey, though he may want a horizontal version of this as well.

Chrisant has offered many variations on what is listed here. Style 1 is a line oriented version of page-up and page down. Probably not that hard to write. Style 2a should be our scroll-up and scroll-down behaviors.

Style 2b is a kind of hybrid: sometimes it moves the cursor; sometimes it doesn't. I'm not a big fan of this approach. It seems like you should start with the conception of whether the cursor should move and then choose the scroll method accordingly. If I'm looking for information in this file but want to modify the current line, I need a scrolling method that leaves the cursor where it is. If I'm not looking to modify the current line, then the cursor should follow along with my scrolling to facilitate a change when I see where to make it.

Style 2c would generate too many bug reports. 8^)

So, with the possible exception of a horizontal version of page-up and page-down and line-by-line versions of the same, I think we have this covered. This is the first such request for changes, so I'm hesitant to introduce any additional motion commands. But I'd love to hear from the community on this one.

evanratt

  • Senior Community Member
  • Posts: 300
  • Hero Points: 23
Re: Panning and Scrolling
« Reply #7 on: April 24, 2008, 05:06:24 PM »
Just a bit curious - you said

Quote
2) SlickEdit provides commands to scroll with the keyboard: scroll-up and scroll-down. The cursor stays on the same line of code.

The behavior I see when using scroll-up and scroll-down is that the cursor stays on the same line of code while that code is on-screen, but once the code leaves the screen the cursor stays at the top or bottom edge of the screen, which is Style 2b that Chrisant described (thanks for giving the styles names, Chrisant - it makes it so much easier to discuss!). Is this not the intended behavior for scroll-up and scroll-down?

I was going to say I prefer this method because I can easily scroll the screen up and down while finding where to make a change, and then the cursor is nearby when I actually have to make the change. However, you are correct, if the cursor stayed in the same place on the screen, I would still be able to work this way; in fact, the cursor would probably be closer to where I would be looking on the screen, so I wouldn't even have to move it back there from the top or bottom edge.

ScottW, VP of Dev

  • Senior Community Member
  • Posts: 1471
  • Hero Points: 64
Re: Panning and Scrolling
« Reply #8 on: April 24, 2008, 06:10:42 PM »
Yup, you're right. With scroll-down and scroll-up the cursor does stop at the top/bottom of the editor window. There are two other functions, scroll-line-down and scroll-line-up which move the cursor past the boundary of the editor window.

So, we do both 2a and 2b.

chrisant

  • Senior Community Member
  • Posts: 1410
  • Hero Points: 131
Re: Panning and Scrolling
« Reply #9 on: April 24, 2008, 10:35:26 PM »
I agree, SlickEdit has sufficient support already; no need to add anything new.

2a and 2b are covered with native commands.
2c seems like a bad idea, I agree (only included it for completeness).
In case anyone is interested in style 1, I've attached a trivial macro (slide_up, slide_down).

hs2

  • Senior Community Member
  • Posts: 2763
  • Hero Points: 292
Re: Panning and Scrolling
« Reply #10 on: April 24, 2008, 11:05:02 PM »
Nice ! Thanks for sharing, HS2

miffed

  • Community Member
  • Posts: 23
  • Hero Points: 0
Re: Panning and Scrolling
« Reply #11 on: June 30, 2008, 04:49:51 PM »
What about scrolling with the mouse-wheel?

In CodeWright, I always enabled this option: "Scrolling moves cursor position"

SlickEdit does not have such an option, so how can I make the cursor remain on the screen when I scroll with the wheel mouse?

Here's my problem: I scroll with the wheel mouse and the cursor stays on the same line of code, which scrolls off the screen and is no longer visible. Then, I switch to a different file in SlickEdit, and when I switch back to the original window, the text is repositioned and the original line of code with the cursor is now positioned in the middle of the screen -- I lost my scrolled-to position.

Is there any way I can simulate the "Scrolling moves cursor position" option that I had in CodeWright?

Thanks!

chrisant

  • Senior Community Member
  • Posts: 1410
  • Hero Points: 131
Re: Panning and Scrolling
« Reply #12 on: June 30, 2008, 06:25:50 PM »
In the Key Bindings part of the Options dialog, click the little mouse icon near the top right and choose the WheelUp or WheelDn events, then bind an appropriate command to them.  Perhaps scroll-up and scroll-down.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 7094
  • Hero Points: 539
Re: Panning and Scrolling
« Reply #13 on: June 30, 2008, 07:10:32 PM »
It seems like CodeWrights implementation of panning is what everyone wants.  Here's a new mouse.e which I know works with V13.0.1.  Load it and set the def_panning macro variable to 1.  It will effect the mouse wheel and the vertical and horizontal scroll bars.

Let me know if this is what everyone wants.  It's easy to change.

hs2

  • Senior Community Member
  • Posts: 2763
  • Hero Points: 292
Re: Panning and Scrolling
« Reply #14 on: June 30, 2008, 09:55:15 PM »
@Clark: While we are at it - seems that v13.0.1 (WXP-SP3) doesn't support mouse event with modifiers (S-/C-) any longer :(
This works well in v12.0.3. Is this confirmed ? And if it's confirmed I hope that this is NOT by design (?) and will be fixed.
Thanks, HS2

PS: I prever the current mouse wheel scrolling behaviour but it's nice to have the choice of course.