notepad-plus-plus / notepad-plus-plus/notepad-plus-plus

[BUG] Incorrect file position

Open
#16,468 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
29.4k
Forks
5.4k
PR merge metrics
No merged PRs in 30d

Description

Is there an existing issue for this?
  • I have searched the existing issues
Description of the Issue

The two attached pdf files are identical, except the 4 characters on the 2nd line.
In test-ko.pdf, the original file, they are accented characters, whereas I replaced them by 4 "a" in test-ok.pdf.

However the position as shown in the status bar is different if you are situated after the 2nd line, whereas it should be identical.

For example, if you put the cursor just before xref in test-ko.pdf, the position reads 968, whereas in test-ok.pdf it reads 964 (which is the correct value).

It seems to be related to accented characters; however changing to single byte encodings do not change the bad behaviour. If you have accented characters, the position is wrong.

Another way to test this is to create a blank file, choose encoding iso8859-1, type éèçà. When the cursor is at the end of the line (just after à) the position says 9 instead of 5.

Steps To Reproduce
  1. Open the pdf file in Notepad++
  2. Go to the start of line 81 (xref)
  3. Look at the position in the status bar
Current Behavior

the position is off by the number of accented characters situated before the cursor

Expected Behavior

the position should be the position in bytes within the file

Debug Information
Notepad++ v8.7.5   (64-bit)
Build time : Dec 21 2024 - 05:13:03
Path : C:\Program Files\Notepad++\notepad++.exe
Command Line : "C:\Work\pdfinc\PDFinclude4.0\pdfinclude\tmp\customers\heliotextil\20250425\test-ok.pdf" "C:\Work\pdfinc\PDFinclude4.0\pdfinclude\tmp\customers\heliotextil\20250425\test-ko.pdf"
Admin mode : OFF
Local Conf mode : OFF
Cloud Config : OFF
Periodic Backup : ON
Placeholders : OFF
DirectWrite : OFF
Multi-instance Mode : monoInst
File Status Auto-Detection : cdEnabledNew (for current file/tab only)
Dark Mode : ON
OS Name : Windows 10 Pro (64-bit)
OS Version : 22H2
OS Build : 19045.5737
Current ANSI codepage : 1252
Plugins : 
    3P (1.8.8)
    mimeTools (3.1)
    NppConverter (4.6)
    NppExport (0.4)
Anything else?

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the discrepancy with test-ko.pdf, test-ok.pdf, and the ISO-8859-1 example, then trace the status-bar position calculation used when the cursor moves past accented characters. Done means the displayed position matches the byte offset within the file for both examples.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.