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

Add an option to prevent the arrow keys from moving cursor to previous/next line #11444

Closed
m6502 opened this issue Mar 28, 2022 · 21 comments
Closed

Comments

@m6502
Copy link
Contributor

m6502 commented Mar 28, 2022

Description of the Issue

Caret moves to the previous or next line when moving left or right and reaching the start or the end of the lines. There's no easy way to change the behavior unless resorting to hacky methods.

Steps to Reproduce the Issue

Load or type some lines of text. Press left until reaching the start of a line, or right until reaching the end of a line. If there's any line before or after the current one the caret will wrap to the end of the previous line or the start of the next one. Open the settings menu and go to Preferences -> Editing. No option there.

Expected Behavior

Having a checkbox for this.

Actual Behavior

There's no checkbox for this.

Opening this issue as a prerequisite for an incoming pull request.

@TazzyT
Copy link

TazzyT commented Mar 28, 2022

Look for "word wrap" in the icon bar. That is the line wrap.
You can also find it under View > Word wrap.

@m6502
Copy link
Contributor Author

m6502 commented Mar 28, 2022

Hi, these are two different things. "Word wrap" is related to how the text is displayed and makes long lines fully visible with a smaller window by splitting them adding "virtual" unnumbered lines. "Line wrap" is related to edition itself and determines where the caret goes when moving within the text and reaching the start or the end of a line and trying to continue moving in that direction.

@dfs-
Copy link

dfs- commented Mar 29, 2022

Just as a general question: why don't you use the HOME/POS1 and END key? Is the use-case different from what those keys do?

@m6502
Copy link
Contributor Author

m6502 commented Mar 29, 2022

I use these keys thorougly too, of course. Sometimes it's better to use the arrows and sometimes it's better to use these. I don't see how that is relevant to this issue.

@alankilborn
Copy link
Contributor

@m6502 Can you cite other text editors that support the behavior you'd like to see in Notepad++?

@m6502
Copy link
Contributor Author

m6502 commented Mar 29, 2022

Microsoft Visual Studio. CodeWarrior. Vim. And many more.

@m6502
Copy link
Contributor Author

m6502 commented Mar 29, 2022

Also, Notepad++ already supports it, with the modifications I did to my local copy of the code.

@dfs-
Copy link

dfs- commented Mar 29, 2022

Also, Notepad++ already supports it, with the modifications I did to my local copy of the code.

Excellent, might you want to create a pull request for the change/additional setting?

@alankilborn
Copy link
Contributor

Hmm, my Microsoft Visual Studio doesn't seem to support it...

IMO this isn't needed.
Notepad++ author philosophy is "too many options == no option".

@m6502
Copy link
Contributor Author

m6502 commented Mar 29, 2022

Also, Notepad++ already supports it, with the modifications I did to my local copy of the code.

Excellent, might you want to create a pull request for the change/additional setting?

Sure, that's the reason why I both opened this issue and #11443, which I also have working locally. But as this is the first time I contribute to this project I'm cautious. I want to be sure I don't break translations or resources, as I said in the other issue: #11443 (comment)

@m6502
Copy link
Contributor Author

m6502 commented Mar 29, 2022

Hmm, my Microsoft Visual Studio doesn't seem to support it...

IMO this isn't needed. Notepad++ author philosophy is "too many options == no option".

This has been supported in Microsoft Visual Studio since the 90s.

@alankilborn
Copy link
Contributor

This has been supported in Microsoft Visual Studio since the 90s.

Maybe point out how to configure it to do it?
Plus, if it is a setting that one has to turn on in VS, perhaps such a Notepad++ feature could use the same text in its UI for the feature.

@alankilborn
Copy link
Contributor

But as this is the first time I contribute to this project I'm cautious

I would say submit the PR for the code you have.
If N++ author likes it in general, you can push further commits to get it exactly right.
If it isn't liked, don't waste any more time/thought on it.

@m6502
Copy link
Contributor Author

m6502 commented Mar 29, 2022

This has been supported in Microsoft Visual Studio since the 90s.

Maybe point out how to configure it to do it? Plus, if it is a setting that one has to turn on in VS, perhaps such a Notepad++ feature could use the same text in its UI for the feature.

To be honest I don't even remember ever having had to change anything to make it work that way. It's just the way it's ever worked for me, but I'll search for the specific option and post an update here.

@m6502
Copy link
Contributor Author

m6502 commented Mar 29, 2022

But as this is the first time I contribute to this project I'm cautious

I would say submit the PR for the code you have. If N++ author likes it in general, you can push further commits to get it exactly right. If it isn't liked, don't waste any more time/thought on it.

OK.

@m6502
Copy link
Contributor Author

m6502 commented Mar 29, 2022

OK, that was quick, just verified it with Microsoft Visual Studio 2022.

It seems like Visual Studio disables the line wrapping when Virtual Space is enabled (which I always have) although I don't see why these two should be really related one to another. This would explain why @alankilborn wasn't seeing it work for him; I assume you don't have virtual space enabled.

So to see it, in Visual Studio that's at menu Tools -> Options -> Left panel Text Editor -> All languages -> General -> Settings section -> Enable virtual space checkbox.

@m6502
Copy link
Contributor Author

m6502 commented Mar 29, 2022

To be honest I find these two features, the caret wrapping to the end or start of another line, and virtual space, to be two separate things and I don't know why Microsoft decided to group them. I have added two separate checkboxes, one for each feature, but if there's a good reason for them to be together and just disable the position warp if virtual space is enabled I can change it and submit only one pull request for both.

@alankilborn
Copy link
Contributor

although I don't see why these two should be really related one to another

Well, one thought on that would be if you're holding down the right arrow, moving infinitely into virtual space, there is no opportunity to ever get to the next line via this "wrapping". But, yea, really seem like unrelated features...

So would you advocate a similar tying together of these features if both are implemented in Notepad++? Probably not.

@alankilborn
Copy link
Contributor

alankilborn commented Mar 29, 2022

So would you advocate a similar tying together of these features if both are implemented in Notepad++? Probably not.

Oh, I see you already answered that with:

I have added two separate checkboxes, one for each feature

@m6502
Copy link
Contributor Author

m6502 commented Mar 29, 2022

Well, one thought on that would be if you're holding down the right arrow, moving infinitely into virtual space, there is no opportunity to ever get to the next line via this "wrapping".

Maybe that's the reasoning behind it. Disabling the wrap completely when virtual space is enabled would ensure the behaviour is the same for both directions of horizontal movement: either it does wrap, or it doesn't.

For the sake of completeness, I launched CodeWarrior and verified it does exactly the same: Virtual space and line wrapping go hand to hand there too.

Seen that way I think it would make sense for me to rework this option into the virtual space mode and doing only one pull request.

@m6502
Copy link
Contributor Author

m6502 commented Mar 30, 2022

The pull request for this and #11443 is there now: #11452

@donho donho changed the title Add an option for disabling line wrapping Add an option for prevent the cursor go to previous/next line Apr 6, 2022
@donho donho changed the title Add an option for prevent the cursor go to previous/next line Add an option to prevent the arrow keys from moving cursor to previous/next line Apr 6, 2022
@donho donho closed this as completed in 88ed851 Apr 6, 2022
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

Successfully merging a pull request may close this issue.

4 participants