zufuliu / notepad4

Notepad4 (Notepad2⨯2, Notepad2++) is a light-weight Scintilla based text editor for Windows with syntax highlighting, code folding, auto-completion and API list for many programming languages and documents, bundled with file browser plugin matepath.
Other
2.6k stars 184 forks source link

colmun offset error? #827

Closed Tback1 closed 1 month ago

Tback1 commented 1 month ago

image

我尝试通过 grwpwin 搜索,在结果的colmun位置上grep得到了正确偏移量 但notepad4打开时,这个偏移量参数传递正确 但结果不符合的直觉

启动参数如下:.\Notepad4.exe /g %line%,%column% - %path%

文本就是简单的一串数字0-9 0123456789 查找5这个数字,找到line 1 column 5 直觉来说column:5 应该是对应5后6前的位置,也就是光标此时在5的后边是符合直觉的 或者 4后5前的位置也是能够说的理解的。即光标至少是在5的前后 但现在以line 1 column 5 参数传入notepad4 后光标位置竟然在3的后边,这就比较离谱了 当然传递的参数来看从状态栏能看到line 1 column 5 的位置的确是3后 那这就要考虑两边是怎么定义行首编号,是0还是1, column的偏移是前偏移还是后偏移,这个需要两边统一,或是grepWin能否考虑在column参数传出前添加一个用户手工设置的偏移?


I tried to search through grwpwin, and grepped the correct offset at the colmun position of the result. But when notepad4 was opened, the offset parameter was passed correctly. But the result was not in line with my intuition. The startup parameters were as follows: .\Notepad4.exe /g %line%,%column% - %path% The text was simply a string of numbers 0-9 0123456789 Search for the number 5 and find line 1 column 5 Intuitively, column: 5 should correspond to the position after 5 and before 6, which means that the cursor is now after 5, which is in line with my intuition. Or the position after 4 and before 5 is also understandable. That is, the cursor is at least before or after 5. But now, after passing the line 1 column 5 parameter to notepad4, the cursor position is actually after 3, which is quite outrageous. Of course, from the parameters passed, we can see from the status bar that the position of line 1 column 5 is indeed after 3. Then we need to consider how both sides define the line number, whether it is 0 or 1, and whether the column offset is the front offset or the back offset. This needs to be unified on both sides, or can grepWin consider adding a user-set offset before the column parameter is passed out?

zufuliu commented 1 month ago

The column / character offset is for character after caret, so for first character (0 in screenshot), they are 1/1.

zufuliu commented 1 month ago

Fixed in grepWin.