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

CURRENT_LINE and CURRENT_COLUMN should be one-based not zero-based #8679

Open
sasumner opened this issue Aug 7, 2020 · 4 comments
Open

CURRENT_LINE and CURRENT_COLUMN should be one-based not zero-based #8679

sasumner opened this issue Aug 7, 2020 · 4 comments
Labels

Comments

@sasumner
Copy link
Contributor

sasumner commented Aug 7, 2020

Description of the Issue

To be user-useful, the $(CURRENT_LINE) and $(CURRENT_COLUMN) expansions offered in the Run menu's Run... > The Program to Run box should be "one-based" and not "zero-based".

Steps to Reproduce (STR) the Issue

  1. In a Notepad++ tab, move your caret to line 1, column 1 (start of document)
  2. Invoke the Run menu's Run... command.
  3. Put this text in the input combobox underneath The Program to Run :
    cmd /c echo CURRENT_LINE=$(CURRENT_LINE) CURRENT_COLUMN=$(CURRENT_COLUMN) && pause:

image

  1. Press the Run button.

Expected Behavior

A CMD window opens with CURRENT_LINE=1 CURRENT_COLUMN=1 in it.

Actual Behavior

A CMD window opens with CURRENT_LINE=0 CURRENT_COLUMN=0 in it:

image

The line and column data is always "one less" than it should be, for any line and any column the caret is on.

Additional

  1. If it is thought that users are using these commands as they are, the "fix" could be to implement new expansion variables, suggest: $(CURRENT_LINE1) and $(CURRENT_COLUMN1)

  2. See also Position in "Vertical Edge" and "Go To" should be "one-based" #8629 (comment)

Debug Information

Notepad++ v7.8.9 (32-bit)
Build time : Jul 15 2020 - 20:26:50
Path : C:\.............\npp.7.8.9.bin\notepad++.exe
Admin mode : OFF
Local Conf mode : ON
OS Name : Windows 10 Enterprise (64-bit)
OS Version : 1809
OS Build : 17763.1039
Current ANSI codepage : 1252
Plugins : mimeTools.dll NppConverter.dll NppExport.dll PythonScript.dll

@sasumner sasumner self-assigned this Aug 7, 2020
@sasumner sasumner added the bug label Aug 7, 2020
@Yaron10
Copy link

Yaron10 commented Aug 7, 2020

👍

I have a run command opening the current file (in NPP) in EditPad.
So I changed $(CURRENT_LINE) and $(CURRENT_COLUMN) to "one-based" a long time ago.

I've mentioned this issue a couple of times as a "BTW comment" in other threads.
I know I shouldn't do that. :)

And another "BTW comment": I don't how and why but in #8629 (comment) I thought you were referring to You Are Here: in the Go To dialog (an existing "position"?).

@sasumner
Copy link
Contributor Author

sasumner commented Aug 7, 2020

I changed $(CURRENT_LINE) and $(CURRENT_COLUMN) to "one-based" a long time ago.

(For benefit of anyone else reading:) Well, you mean in your patched/forked version of N++, which sounds highly customized.

Okay, I will go ahead and attempt a change to existing functionality, rather than adding two new expansions as I suggested above. If anyone objects to it, we can always fall back to doing the new additions...

@Yaron10
Copy link

Yaron10 commented Aug 7, 2020

(For benefit of anyone else reading:) Well, you mean in your patched/forked version of N++, which sounds highly customized.

The good responsible moderator! :)

Okay, I will go ahead and attempt a change to existing functionality, rather than adding two new expansions as I suggested above.

👍

@sasumner
Copy link
Contributor Author

sasumner commented Mar 2, 2021

One thing I do, on my Run menu, is to set up a Launch Notepad++ and open current file into it. It opens a totally separate portable version of N++ than the one I'm currently running (I have my own reasons for not wanting to "Open in new instance").

Anyway, I use the -n argument on my "Run" line to attempt to get to the same caret line in the file I currently have active in the instance I am launching from. However, with the existing -n$(CURRENT_LINE) I end up with my caret at the line BEFORE the intended line in the N++ that opens.

Just an additional scenario for why this being zero-based is not the greatest behavior.

@sasumner sasumner removed their assignment Jul 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants