Giter VIP home page Giter VIP logo

daddel80 / notepadpp-multireplace Goto Github PK

View Code? Open in Web Editor NEW
14.0 2.0 4.0 40.17 MB

MultiReplace is a plugin for Notepad++ enabling multi-string replacement, allowing list saving and loading. It provides CSV syntax highlighting and enabling precise column targeting. Additionally, it introduces conditional and computational operations within the replacement string.

License: GNU General Public License v2.0

C 67.19% C++ 29.05% HTML 3.75%
find-and-replace notepad-plus-plus notepad-plusplus-plugin notepadplusplus replace-text string-replace column-filter delimited delimited-data filter-replacement

notepadpp-multireplace's Issues

Ability to translate the plugin

Good afternoonю If it's possible and if it's not difficult, could you add the ability for everyone (me in particular) to translate your plugin into their native language? For example, how this is implemented in NotePad++: there is an XML file that can be edited and get the result that you need. I use your plugin to modify games, correct official localizations, and it’s just nice when all the space around you is in your native language :)

Thank you!

Make Escape key close smarter

If the dialog is just opened as a floating window, Escape key should - and currently does - close the floating dialog window. If however the dialog is docked to the Notepad++ window in one of the four (top, bottom, left, or right) docking spots, Escape key should not close the dialog; rather, it should set focus to the current Scintilla editing component. The thought is if the dialog is docked, the user may want to use it multiple times while swapping back and forth to navigate through the document.

Execution halted

Have the file:

# dest: "d:\blabla"
#> c:\myshortcuts1\|test1.txt.lnk
e:\blabla\|test1.txt
#> c:\myshortcuts2\|test2.txt.lnk
e:\blabla\|test2.txt

Want to replace to:

# dest: "d:\blabla"
#> c:\myshortcuts1\|test1.txt.lnk
c:\myshortcuts1\|test1.txt
#> c:\myshortcuts2\|test2.txt.lnk
c:\myshortcuts2\|test2.txt

The expression:

Selected,Find,Replace,WholeWord,MatchCase,UseVariables,Regex,Extended
1,"^([^\\r\\n\\|]+)(\\|([^\\r\\n\\|]+)(?:\\|([^\\r\\n\\|]+)(?:\\|([^\\r\\n\\|]+))?)?)?","init({DESTDIR=""""}); if CAP1 ~= nil and string.sub(CAP1,1,2) == ""#>"" then DESTDIR=string.sub(CAP1,4,-1) elseif CAP1 ~= nil and string.len(DESTDIR) and CAP2 ~= nil then set(DESTDIR..""|""..CAP2) end",0,0,1,0,1

Result:

---------------------------
Use Variables: Execution Error
---------------------------
Execution halted due to execution failure in:

init({DESTDIR=""}); if CAP1 ~= nil and string.sub(CAP1,1,2) == "#>" then DESTDIR=string.sub(CAP1,4,-1) elseif CAP1 ~= nil and string.len(DESTDIR) and CAP2 ~= nil then set(DESTDIR.."|"..CAP2) end
---------------------------
OK   
---------------------------

Can you help with the expression?

all open documents

Is there a way to do a search and replace on all open documents? You can do this with the built-in function. Thanks!

32-bit warning as error again

notepadpp-multireplace/src/MultiReplace.cpp:

677:     for (int i = 0; i < replaceListData.size(); i++) {

should be size_t

Replace using Capture Variables

Trying to renumber the ini keys from #31 with new syntax:

Find what:

^(button|cmd|param|path|iconic|menu)\d*=

Replace with:

init({BTTNCNT=0}); if "$1" == "button" then BTTNCNT=BTTNCNT+1 end; set("$1"..BTTNCNT.."=")

But it does not seem to work.

The set always returns .0=.

32-bit build failing due to sign mismatch warning and treat warnings as errors

When building the 32-bit version, I'm getting several warnings about sign mismatch in "src\MultiReplace.cpp":

notepadpp-multireplace\src\MultiReplace.cpp(448,42):  warning C4018: '>=': signed/unsigned mismatch [notepadpp-multireplace\vs.proj\NppMultiReplace.vcxproj]
notepadpp-multireplace\src\MultiReplace.cpp(467,42):  warning C4018: '>=': signed/unsigned mismatch [notepadpp-multireplace\vs.proj\NppMultiReplace.vcxproj]
notepadpp-multireplace\src\MultiReplace.cpp(502,129): warning C4389: '==': signed/unsigned mismatch [notepadpp-multireplace\vs.proj\NppMultiReplace.vcxproj]
notepadpp-multireplace\src\MultiReplace.cpp(1077,14): warning C4018: '<':  signed/unsigned mismatch [notepadpp-multireplace\vs.proj\NppMultiReplace.vcxproj]
notepadpp-multireplace\src\MultiReplace.cpp(1131,30): warning C4018: '>=': signed/unsigned mismatch [notepadpp-multireplace\vs.proj\NppMultiReplace.vcxproj]
notepadpp-multireplace\src\MultiReplace.cpp(1290,28): warning C4018: '<=': signed/unsigned mismatch [notepadpp-multireplace\vs.proj\NppMultiReplace.vcxproj]
notepadpp-multireplace\src\MultiReplace.cpp(1581,40): warning C4018: '<':  signed/unsigned mismatch [notepadpp-multireplace\vs.proj\NppMultiReplace.vcxproj]

The build fails since in "vs.proj\NppMultiReplace.vcxproj", the <TreatWarningAsError>true</TreatWarningAsError> is set in all the ItemDefinitionGroup's.

You could just set that to false for the 32-bit build configurations. Better would be to examine how / why the comparisons are between int and size_t (in most cases) and see if that could be fixed or just cast the size_t to int minding:

https://stackoverflow.com/questions/3642010/can-i-compare-int-with-size-t-directly-in-c

Cheers.

Wrong dlgID in multiReplace()

The member dlgID should:

        // the dlgDlg should be the index of funcItem where the current function pointer is
        // in this case is DOCKABLE_DEMO_INDEX

That is 0 from:

notepadpp-multireplace/src/PluginDefinition.cpp:

71:     setCommand(0, TEXT("&Multi Replace && Mark"), multiReplace, NULL, false);
72:     setCommand(1, TEXT("&About"), about, NULL, false);

however, it is set to 3.

Regexp rename with a counter

Is there a way?

I need to rename key names in an ini file:

[section1]
Buttoncount=2

button1=...
cmd1=...
menu1=...

button2=...
cmd2=...
menu2=...

I want to insert a button (block of keys) between 1 and 2 and call the replacer to rename all keys using the counter variable:

[section1]
Buttoncount=2

button1=...
cmd1=...
menu1=...

; inserted values
button=...
cmd=...
menu=...

button2=...
cmd2=...
menu2=...

Version is misreported

See:

PS VinsWorldcom C:\usr\bin\npp64\plugins\NppMultiReplace > (Get-Item .\NppMultiReplace.dll).VersionInfo

ProductVersion   FileVersion      FileName
--------------   -----------      --------
4.3              4.3              C:\usr\bin\npp64\plugins\NppMultiReplace\NppMult...

Coming from:

#define VERSION_VALUE "4.3\0"

Dots incorrect replacement in regexp expressions

File:

# dest: "d:\blabla"
#> c:\test1\test1.aaa|test1.txt.lnk
e:\blabla\|test1.txt
#> c:\test2\test2.bbb|test2.txt.lnk
e:\blabla\|test2.txt

Want to replace to:

# dest: "d:\blabla"
#> c:\test1\test1.aaa|test1.txt.lnk
c:\test1\test1.aaa|test1.txt
#> c:\test2\test2.bbb|test2.txt.lnk
c:\test2\test2.bbb|test2.txt

The expression:

1,"^([^\\r\\n\\|]+)(?:\\|([^\\r\\n\\|]+)(?:\\|([^\\r\\n\\|]+)(?:\\|([^\\r\\n\\|]+))?)?)?","init({DESTDIR="""",REPLACETO=""""}); if CAP1 ~= nil and string.sub(CAP1,1,3) == ""#> "" then DESTDIR=string.match(string.sub(CAP1,4,-1),""^(.+)\\\\"") elseif CAP1 ~= nil and string.sub(CAP1,1,1) ~= ""#"" and string.len(DESTDIR) > 0 and CAP2 ~= nil then REPLACETO=DESTDIR..""\\\\|""..CAP2 end; cond(CAP1 ~= nil and CAP2 ~= nil and string.len(CAP1) > 0 and string.len(CAP2) > 0 and string.sub(CAP1,1,1) ~= ""#"" and string.len(REPLACETO) > 0, REPLACETO)",0,0,1,0,1

Result:

# dest: "d:\blabla"
#> c:\test1\test1.aaa|test1.txt.lnk
c:\test1\test1|test1.txt
#> c:\test2\test2.bbb|test2.txt.lnk
c:\test2\test2|test2.txt

32-bit build warning as error signed mismatch (again)

Some new updates have reintroduced an old warning as error again:

notepadpp-multireplace\src\MultiReplace.cpp(2143,23): warning C4018: '<': signed/unsigned mismatch

notepadpp-multireplace\src\MultiReplace.cpp(2143,23): error C2220: the following warning is treated as an error 

Due to line:

    for (int i = 0; i < replaceListData.size(); i++) {

Guessing replaceListData.size() is of size_t.

Cheers.

Extra files from template

The files:

  • src/DockingFeature/GoToLineDlg.cpp
  • src/DockingFeature/GoToLineDlg.h
  • src/DockingFeature/goLine.rc

seem to be unnecessary cruft from the template plugin.

Build issue from command line

When using standard msbuild from command line, getting:

notepadpp-multireplace\src\AboutDialog.cpp(ROW,COL): error C2065: 'IDC_***': undeclared identifier

type errors. Due to missing:

#include "DockingFeature/resource.h"

in 'src\AboutDialog.cpp'.

Also, getting:

src\MultiReplace.h(20,10): fatal error C1083: Cannot open include file: 'resource.h': No such file or directory

due to incorrect include, should be:

#include "DockingFeature\resource.h"

Parentheses incorrect replacement in regexp expression

File:

c:\dir1\|aaa (bbb) ccc
#> d:\dirA\ddd
c:\dirB\|aaa (bbb) ccc
#> d:\dirC\ddd
c:\dirD\|bbb) ccc

Want to replace to:

c:\dir1\|aaa (bbb) ccc
#> d:\dirA\ddd
d:\dirA\|aaa (bbb) ccc
#> d:\dirC\ddd
d:\dirC\|bbb) ccc

The expression:

Selected,Find,Replace,WholeWord,MatchCase,UseVariables,Regex,Extended
1,"^([^\\r\\n\\|]+)(?:\\|([^\\r\\n\\|]+)(?:\\|([^\\r\\n\\|]+)(?:\\|([^\\r\\n\\|]+))?)?)?","init({DESTDIR="""",REPLACETO=""""}); if CAP1 ~= nil and string.sub(CAP1,1,3) == ""#> "" then DESTDIR=string.match(string.sub(CAP1,4,-1),""^(.+)\\\\"") elseif CAP1 ~= nil and string.sub(CAP1,1,1) ~= ""#"" and string.len(DESTDIR) and CAP2 ~= nil then REPLACETO=DESTDIR..""\\\\|""..CAP2 end; cond(CAP1 ~= nil and CAP2 ~= nil and string.len(CAP1) and string.len(CAP2) and string.sub(CAP1,1,1) ~= ""#"" and string.len(REPLACETO), REPLACETO)",0,0,1,0,1

Result:

|aaa bbb ccc
#> d:\dirA\ddd
d:\dirA\|aaa bbb ccc
#> d:\dirC\ddd
d:\dirC\|bbb

Additionally, the first line should not be replaced, because REPLACETO is empty, but anyway it does replacement.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.