Skip to content

notepad.getCurrentDocIndex(v) doesn't return -1 if view 'v' is not open #255

Closed
@alankilborn

Description

@alankilborn

If I execute notepad.getCurrentDocIndex(1) and view 1 is not currently open, this occurs:

>>> notepad.getCurrentDocIndex(1)
18446744073709551615L

This is on 64-bit N++/PS and PS 2.0 (or 3.10.2). Tested in combination with N++ v8.4.6.

I would think that on 32-bit the following would occur, but I have not recently tested this:

>>> notepad.getCurrentDocIndex(1)
4294967295L

The Notepad++ code should be sending the plugin -1, see here: https://github.com/notepad-plus-plus/notepad-plus-plus/blob/6000f3bb21a42a4d28d068617e0dc642ef739b26/PowerEditor/src/NppBigSwitch.cpp#L1510

and I would expect to see this:

>>> notepad.getCurrentDocIndex(1)
-1

in either the 32-bit or 64-bit case.


Note: Workaround from Eko (after import ctypes):

>>> ctypes.c_ssize_t(notepad.getCurrentDocIndex(1)).value
-1L

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions