• Comparing issue

    2
    0 Votes
    2 Posts
    527 Views
    PeterJonesP

    @manish-thukral ,

    You need to make sure you have the right version of the Compare plugin for your version of Notepad++. Check the Plugins Admin for updates on the plugin. (Specifically, if you are at NPP v8.3 or newer, you must use Compare Plugin 2.0.2 or it will not work right.)

  • tài liệu quản lý dự án.

    2
    0 Votes
    2 Posts
    491 Views
    PeterJonesP

    When Google Translate changes your post to English:

    There are two project management models, waterfall and agile

    This doesn’t seem to have anything to do with Notepad++. Please keep posts in the Notepad++ Community related to Notepad++.

  • Generic Regex: Replacing in a specific zone of text

    2
    6 Votes
    2 Posts
    3k Views
    guy038G

    Two other examples regarding this generic regex ! In these ones, we’ll even restrict the replacements to each concerned zone before a # character !

    Paste the text below in a new tab :

    <iden>123456 (START)</iden> <name>Case_1</name> <descrip>This is a (short) text to (easily) see the results (of the modifications)# (12345) test (67890)</descrip> <param>val (250)</param> <iden>123456</iden> <name>Case_2</name> <descrip>And the (obvious) changes occur only in (the) "descrip" tag # Parentheses (Yeaah) OK</descrip> <param>val (500)</param> <iden>123456 (END)</iden> <name>Case_3</name> <descrip>All (the) other tags are (just) untouched #(This is) the end (of the test)</descrip> <param>val (999)</param>

    In this first example, of single-line <descrip> tags , two solutions are possible :

    Use the complete generic regex (?-si:BSR|(?!\A)\G)(?s-i:(?!ESR).)*?\K(?-si:FR) where ESR = # which leads to the functional S/R :

    SEARCH (?-s)(?-i:<descrip>|(?!\A)\G)((?!#).)*?\K(?:\x20\(.+?\))

    REPLACE Leave EMPTY

    => This time, in addition to only replace in each <descrip>..........</descrip> zone, NO replacement will occur after the # character of each <descrip> tag !

    Use the simplified solution and add a ESR condition at the end of the regex, giving this generic variant (?-s)(?-i:BSR|(?!\A)\G).*?\K(?-i:FR)(?=ESR)

    SEARCH (?-s)(?-i:<descrip>|(?!\A)\G).*?\K(?:\x20\(.+?\))(?=.*#)

    REPLACE Leave EMPTY

    However, this other solution needs that all the <descrip> tags contains a comment zone with a # char

    Now, paste this other text below in a new tab :

    <val>37--001</val> <text>This-is -a--very---< # Dashes - - - OK/text> <pos>4-1234</pos> <val>37--002</val> <text>-small----#---example</text> <pos>9-0012</pos> <val>37--003</val> <text>-of-a-text- which-</text> <pos>1-9999</pos> <val>37--004</val> <text>need -to-be- modi fied # but - not - there</text> <pos>0-0000</pos>

    This second example is a multi-lines replacement, in each <text>.............</text> zone only and also limited to the part before a # char which can be present or not

    Of course, we’ll have to use the complete generic regex (?-si:BSR|(?!\A)\G)(?s-i:(?!ESR).)*?\K(?-si:FR) but, instead of a single (?!ESR), we’ll have to use this variant :

    (?-si:BSR|(?!\A)\G)(?s-i:(?!ESR_1)(?!ESR_2).)*?\K(?-si:FR)

    So, the functional regex S/R becomes :

    SEARCH (?-si:<text>|(?!\A)\G)(?s-i:(?!</text>)(?!#).)*?\K-+

    REPLACE \x20

    => ONLY IF a sequence of dashes is located in a <text>..........</text> zone AND, moreover, before a possible # char, it will be replaced with a single space character

    As you can verify, the third multi-lines <text>.............</text> zone does not contain any # char. Thus, all dash characters, of that <Text> tag, are replaced with a single space char !

    Remainder :

    You must use, at least, the v7.9.1 N++ release, so that the \A assertion is correctly handled

    Move to the very beginning of file, before any Find Next sequence or Replace All operation

    Do not click on the step-by-step Replace button

  • 1 Votes
    1 Posts
    564 Views
    No one has replied
  • Generic Regex: Logic Gates for Regular Expressions

    2
    2 Votes
    2 Posts
    2k Views
    Lycan ThropeL

    @peterjones ,
    Thank you for this synopsis. This will take a little while to digest, but at least there is a succinct description we neophytes can come and learn the way you explain things in detail. Thanks again.

  • Crash and Loose

    3
    0 Votes
    3 Posts
    582 Views
    PeterJonesP

    @cinetica-constructiva ,

    Since you claim you have Notepad++ v8.2 (showing us ?-menu’s Debug Info would give us more to go on), then I can ask: Did you leave the nppLogNulContentCorruptionIssue.xml in the Notepad++ installation folder? If so, did Notepad++ create nppLogNulContentCorruptionIssue.log, either in %AppData%\Notepad++ (or the Notepad++-in-Wine-in-Ubuntu equivalent) or in the Notepad++ installation folder. Despite using it in an unsupported environment, that logfile may contain useful information.

  • PasteSpecial - revisited

    16
    4 Votes
    16 Posts
    3k Views
    PeterJonesP
    pasteSpecial.pl - v2.1

    Updates:

    Fix “bitmap” bug (if a bitmap was in the clipboard, trying to preview would cause script to crash)

    Requirements:

    Perl Install “PerlScript” module

    Usage

    Notepad++ menu: Run > Run: "c:\path\to\perl.exe" "c:\path\to\pasteSpecial.pl" #!/usr/bin/env perl ################################################ # PasteSpecial for Notepad++ # List formats currently on the clipboard # Allows you to choose one of those formats # Will paste the selected type (UTF8-encoded) # at the current location in the active file ################################################ # HISTORY # v0.1: STDIN-based choice # v1.0: DialogBox choice # v2.0: Add REFRESH button to update the ListBox # Defaults to selecting/displaying the first Clipboard variant # Persist checkbox allows dialog to stay open for multiple pastes # v2.1: Fix the "bitmap" bug (having bitmaps is clipboard caused crash) ################################################ use 5.010; use warnings; use strict; use Win32::Clipboard; use Win32::GUI; use Win32::GUI::Constants qw/CW_USEDEFAULT/; use Encode; use Win32::Mechanize::NotepadPlusPlus 0.004 qw/:main/; # this works even with v0.004, even without bugfix for prompt() our $VERSION = 'v2.1'; BEGIN { binmode STDERR, ':utf8'; binmode STDOUT, ':utf8'; } my %map = ( CF_TEXT() => 'CF_TEXT', CF_BITMAP() => 'CF_BITMAP', CF_METAFILEPICT() => 'CF_METAFILEPICT', CF_SYLK() => 'CF_SYLK', CF_DIF() => 'CF_DIF', CF_TIFF() => 'CF_TIFF', CF_OEMTEXT() => 'CF_OEMTEXT', CF_DIB() => 'CF_DIB', CF_PALETTE() => 'CF_PALETTE', CF_PENDATA() => 'CF_PENDATA', CF_RIFF() => 'CF_RIFF', CF_WAVE() => 'CF_WAVE', CF_UNICODETEXT() => 'CF_UNICODETEXT', CF_ENHMETAFILE() => 'CF_ENHMETAFILE', CF_HDROP() => 'CF_HDROP', CF_LOCALE() => 'CF_LOCALE', ); my %rmap; @rmap{values %map} = keys %map; my $CLIP = Win32::Clipboard; my $answer = runDialog(); #editor->addText(Encode::encode("UTF8", $answer)) if defined $answer; #v1.3: moved to the PASTE button, below exit; sub formats { my @f = $CLIP->EnumFormats(); foreach my $format (sort {$a <=> $b} @f) { $map{$format} //= $CLIP->GetFormatName($format) // '<unknown>'; $rmap{ $map{$format} } = $format; } return @f; } sub runDialog { my $clipboard; my $persist = 1; my $dlg = Win32::GUI::Window->new( -title => sprintf('Notepad++ Paste Special %s', $VERSION), -left => CW_USEDEFAULT, -top => CW_USEDEFAULT, -size => [580,300], -resizable => 0, -maximizebox => 0, -hashelp => 0, -dialogui => 1, ); my $icon = Win32::GUI::Icon->new(100); # v1.1: change the icon $dlg->SetIcon($icon) if defined $icon; my $update_preview = sub { my $self = shift // return -1; my $value = $self->GetText($self->GetCurSel()); my $f=$rmap{$value}; $clipboard = $CLIP->IsBitmap() ? $CLIP->GetBitmap() : $CLIP->IsFiles() ? ($CLIP->GetFiles())[0] : $CLIP->GetAs($f); $clipboard = Encode::decode('UTF16-LE', $clipboard) if $f == CF_UNICODETEXT(); (my $preview = $clipboard) =~ s/([^\x20-\x7F\r\n])/sprintf '\x{%02X}', ord $1/ge; $preview =~ s/\R/\r\n/g; $preview = substr($preview,0,297)."..." if length($preview)>300; $self->GetParent()->PREVIEW->Text( $preview ); return 1; }; my $lb = $dlg->AddListbox( -name => 'LB', -pos => [10,10], -size => [230, $dlg->ScaleHeight()-10], -vscroll => 1, -onSelChange => $update_preview, # v1.2: externalize this callback so it can be run from elsewhere ); my $refresh_formats = sub { my $lb = $dlg->LB; my $selected_idx = $lb->GetCurSel() // 0; my $selected_txt = ((0<=$selected_idx) && ($selected_idx < $lb->Count)) ? $lb->GetText($selected_idx) : ''; $lb->RemoveItem(0) while $lb->Count; $lb->Add( @map{ sort {$a<=>$b} formats() } ); my $new_idx = $selected_txt ? $lb->FindStringExact($selected_txt) : undef; $new_idx = undef unless defined($new_idx) && (0 <= $new_idx) && ($new_idx < $lb->Count); $lb->Select( $new_idx//0 ); $update_preview->( $lb ); }; my $button_top = $dlg->LB->Top()+$dlg->LB->Height()-25; $dlg->AddButton( # v1.2: add this button -name => 'REFRESH', -text => 'Refresh', -size => [80,25], -left => $dlg->ScaleWidth()-90*3, -top => $button_top, -onClick => sub{ $refresh_formats->(); 1; }, ); $dlg->AddButton( -name => 'OK', -text => 'Paste', -size => [80,25], -left => $dlg->ScaleWidth()-90*2, -top => $button_top, -onClick => sub{ # v1.3: allow to persist after paste: TODO: move the editor->addText here editor->addText( Encode::encode("UTF8", $clipboard) ) if defined $clipboard; return $persist ? 1 : -1; }, ); $dlg->AddButton( -name => 'CANCEL', -text => 'Cancel', -size => [80,25], -left => $dlg->ScaleWidth()-90*1, -top => $button_top, -onClick => sub{ $clipboard=undef; -1; }, ); $dlg->AddGroupbox( -name => 'GB', -title => 'Preview', -pos => [250,10], -size => [$dlg->ScaleWidth()-260, $button_top-20], ); $dlg->AddLabel( -name => 'PREVIEW', -left => $dlg->GB->Left()+10, -top => $dlg->GB->Top()+20, -width => $dlg->GB->ScaleWidth()-20, -height => $dlg->GB->ScaleHeight()-40, ); $dlg->AddCheckbox( -name => 'CB', -text => 'Persist', -pos => [$dlg->GB->Left(), $button_top], -onClick => sub { $persist = !$persist; 1; }, ); $dlg->CB->SetCheck($persist); $refresh_formats->(); $dlg->Show(); Win32::GUI::Dialog(); return $clipboard; }
  • Marking/Searching/Replacing issues

    2
    0 Votes
    2 Posts
    430 Views
    Alan KilbornA

    @Paul-Whaley

    What does this part of the Find dialog look like for you?:

    c95f467e-7e0a-4aa1-8f6d-a352df8601d8-image.png

    Seems like you want Normal but you probably have Regular expression set ??

  • 1 Votes
    4 Posts
    1k Views
    marianogedismanM

    T-This is BEAUTIFUL ( ♡∀♡)

  • Youssef Land and Notepad++ Community

    2
    -1 Votes
    2 Posts
    381 Views
    Alan KilbornA

    @yoyomonem

    If that’s an announcement of a new OS from Microsoft, I think you missed the mark by almost a couple of decades. And it’s off-topic for a Notepad++ forum.

  • The snake game in python

    2
    0 Votes
    2 Posts
    887 Views
    Alan KilbornA

    One question: WHY?

  • Search issue

    2
    0 Votes
    2 Posts
    405 Views
    Alan KilbornA

    @A-Shrinivas-Rao said in Search issue:

    f I need to go up I need to check Backward direction or vice versa.

    Have you tried 2-button find mode?

    Turn it on with this, by ticking the box with the speech bubble:

    36cfa5b3-f961-4b4a-8186-c513923c9054-image.png

    And it will then look like this:

    6e20872c-60a3-4ca5-b349-49c31f09978f-image.png

    And you can then forget the Backward direction checkbox is even there.

    Alternatively, with the keyboard, Enter will search forwards and Shift+Enter will search backwards.

    Plenty of options so your time isn’t wasted. :-)

  • Help me Please.I don's solv this problem.

    6
    0 Votes
    6 Posts
    588 Views
    Md ZiarulM

    @Alan-Kilborn I use run in chrome.

  • Long paths support

    17
    0 Votes
    17 Posts
    4k Views
    Juan MillerJ

    Try “LongPathTool program” that is best solution.

  • Multiple Vertical Edges: Documentation

    1
    2 Votes
    1 Posts
    1k Views
    No one has replied
  • Launch in default Web browser

    3
    3 Votes
    3 Posts
    8k Views
    ?

    From my point of view, I was wondering how Search on Internet worked versus the Launch in Chrome, Launch in Firefox etc shown in the default shortcuts.xml. I had long copied the examples in shortcuts.xml for browser shortcuts. But, I was then forced to modify shortcuts.xml when I switched my default browser. Those examples always explicitly gave a browser (due to Web development). And I followed that convention. Search on Internet followed the default browser.

    I first tried searching in the NPP sources. But I can’t read C++ well enough.

    I happened on Launch in Web browser · Issue #472 where Mr. Ho simply says “It’s been done.” I wasn’t sure what that could mean and then found the answer I linked to in my original post.

    I typically disable clickable links as a first customization. So, it made sense to me that clickable links was the implied solution.

    My muscle memory is set to the shortcuts I’ve developed. So, I kept experimenting with the examples in shortcuts.xml until I realized <command /> was just some escaped wrapper for a plain Run prompt. I had previously made the leap to use Start-Process to invoke URLs from the shell. So, I tried directly invoking a URL from NPP and it worked.

    I did not realize there had been a recent discussion. My searches had centered around “default Web browser” thus the GitHub issue. I don’t remember seeing this other discussion.

    Now, even my PowerShell function has encoding and a fixed protocol. – Since this literally executes whatever is selected, I threw in annoying warnings.

  • Help add a feature to the site

    2
  • After updating plugins and theme my WordPress website is down

    2
  • Insist on a Roadmap to Start Development

    2
    0 Votes
    2 Posts
    503 Views
    Alan KilbornA

    @Javier-Sánchez

    See https://github.com/notepad-plus-plus/notepad-plus-plus/blob/master/CONTRIBUTING.md

    with the fact that the developers, apparently don’t take a glance here

    I’m sure some do and some don’t.

    I want to contribute with the syntax ruling and look of a very well known programming language (which I’d mention later on) in a very well known hardware (which I’d mention later). Why mention later? Well, when I get the least hint, I’ll do that.

    “which I’d mention later”? With a statement like that, I’m sure absolutely no one cares. Good luck with the results to your "insist"ing.

  • Multi editing using Notepad++

    4
    1 Votes
    4 Posts
    1k Views
    dinkumoilD

    @Alan-Kilborn

    You are right, the way multi-editing is implemented currently is not very useful - to much hassle to place the cursor at multiple locations and you could easily miss one location.

    But with the new Scintilla commands SCI_MULTIPLESELECTADDNEXT and SCI_MULTIPLESELECTADDEACH we got the missing features to enjoy the power of multi-editing. If you are sure you want to overtype all occurences of a certain string send SCI_MULTIPLESELECTADDEACH. If you know that the string only occurs in a few locations near by the cursor (e.g. an if..else...endif block) send SCI_MULTIPLESELECTADDNEXT multiple times. Of course a scripting plugin is needed to be able to send these commands to Scintilla.

    In this comment @dail posted some Lua code to emulate SCI_MULTIPLESELECTADDNEXT in Notepad++ versions prior to v7.7 (which introduced the Scintilla version necessary for the two commands mentioned above). I was able to modify it to create an emulator for SCI_MULTIPLESELECTADDEACH as well (maybe I found that code somewhere, too), here are the two functions:

    npp.AddShortcut("Selection Add Next", "", function() -- From SciTEBase.cxx local flags = SCFIND_WHOLEWORD -- can use 0 editor:SetTargetRange(0, editor.TextLength) editor.SearchFlags = flags -- From Editor.cxx if editor.SelectionEmpty or not editor.MultipleSelection then local startWord = editor:WordStartPosition(editor.CurrentPos, true) local endWord = editor:WordEndPosition(startWord, true) editor:SetSelection(startWord, endWord) else local i = editor.MainSelection local s = editor:textrange(editor.SelectionNStart[i], editor.SelectionNEnd[i]) local searchRanges = {{editor.SelectionNEnd[i], editor.TargetEnd}, {editor.TargetStart, editor.SelectionNStart[i]}} for _, range in pairs(searchRanges) do editor:SetTargetRange(range[1], range[2]) if editor:SearchInTarget(s) ~= -1 then editor:AddSelection(editor.TargetStart, editor.TargetEnd) -- To scroll main selection in sight editor:ScrollRange(editor.TargetStart, editor.TargetEnd) break end end end -- To turn on Notepad++ multi select markers editor:LineScroll(0, 1) editor:LineScroll(0, -1) end) npp.AddShortcut("Selection Add All", "", function() local flags = SCFIND_WHOLEWORD -- can use 0 local startWord = -1 local endWord = -1 local s = "" editor.SearchFlags = flags if editor.SelectionEmpty or not editor.MultipleSelection then startWord = editor:WordStartPosition(editor.CurrentPos, true) endWord = editor:WordEndPosition(startWord, true) editor:SetSelection(startWord, endWord) else local i = editor.MainSelection startWord = editor.SelectionNStart[i] endWord = editor.SelectionNEnd[i] end s = editor:textrange(startWord, endWord) while true do editor:SetTargetRange(0, editor.TextLength) local i = editor.MainSelection local searchRanges = {{editor.SelectionNEnd[i], editor.TargetEnd}, {editor.TargetStart, editor.SelectionNStart[i]}} local itemFound = false for _, range in pairs(searchRanges) do editor:SetTargetRange(range[1], range[2]) if editor:SearchInTarget(s) ~= -1 then editor:AddSelection(editor.TargetStart, editor.TargetEnd) itemFound = true break end end if editor.TargetStart == startWord and editor.TargetEnd == endWord or not itemFound then break end end -- To turn on Notepad++ multi select markers editor:LineScroll(0, 1) editor:LineScroll(0, -1) end)