Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] SMART Cursor Movement (ala TextPad) #9039

Open
Gadhouse opened this issue Oct 20, 2020 · 4 comments
Open

[Feature Request] SMART Cursor Movement (ala TextPad) #9039

Gadhouse opened this issue Oct 20, 2020 · 4 comments

Comments

@Gadhouse
Copy link

Gadhouse commented Oct 20, 2020

Description of the Issue

Feature Request

Steps to Reproduce the Issue / Expected Behaviour

I'm starting now to use Notepad++ after many years of usage of Textpad. The only missing thing I found is what was described by @TroglodyteGuy on Issue #2906. This issue has been marked as closed but actually is still ongoing.

I'm referring to this behaviour:

For example, say I have the following two lines, with the cursor positioned at the pipe:

The quick | fox jumped
over the lazy dog.

...and then I typed "brown", the cursor would end up here:

The quick brown| fox jumped
over the lazy dog.

...in most editors (including Notepad++), if I then pressed the down arrow, I'd wind up with this:

The quick brown fox jumped
over the lazy d|og.

However, TextPad ends up with this:

The quick brown fox jumped
over the l|azy dog.

It seems the editor is keeping track of both the cursor's "current X position" and the "base X position", which is "the original X position before any editing occurred since the last horizontal cursor navigation command". Then, if you move the cursor up or down (with either up/down arrows, or pgup/pgdn), the cursor tries to keep as close to the original X position as possible, but within the current line's constraints. The base X position is updated next time you manually position the cursor horizontally (e.g. left/right arrows, mouse click, etc).

This particular movement of the caret is very useful when trying to insert different text over the lines.
It would be great to add this behaviour as an option.

@sasumner
Copy link
Contributor

The only issue I have with your "issue" is calling it "SMART" in the title. :-)
I would maybe call it "alternative".

Most people seem to wish to have the opposite behavior when the your desired behavior is noticed to have occurred.
Here's one very-recent example: https://community.notepad-plus-plus.org/post/58787 and below it.
This leads to the Scintilla documentation: https://www.scintilla.org/ScintillaDoc.html#SCI_CHOOSECARETX

The problem is, there seems to be a good way of NOT doing it, when it is noticed to be occurring, by inserting a call to SCI_CHOOSECARETX.
But...there may not be a good way to do it when you want it.

@Gadhouse
Copy link
Author

@sasumner : yeah, maybe "smart" was too personal :).
I've taken a look at Scintilla documentation, I don't know if it's the best solution or not, sorry for the noob question, how can use that parameter?

@sasumner
Copy link
Contributor

I've taken a look at Scintilla documentation ... how can use that parameter?

I was just pointing out that calling the function I referenced is a cure for the opposite situation (when you move your caret vertically and it "jumps" horizontally). I know of no way to handle the opposite situation, but maybe someone else has a suggestion?

Anyway, YOU (as a user) can't use that function (or a similar one that does the opposite behavior), but a N++ coder can call these type of functions to achieve a goal, at the right place in the source code.

@Gadhouse
Copy link
Author

Got it, thanks. Hope someone has a suggestion on how to make it possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants