• text becomes blurry

    5
    0 Votes
    5 Posts
    4k Views
    gstaviG

    @jonathan-patterson

    There are lots of issues with High DPI monitors. Notepad++ tries to be “DPI Aware” and many of the features around this are new to Windows. Could be that a related change is not backward compatible with Windows 7.

    Generally the blurry area is rendered by Scintilla and not by Notepad++ itself. And Scintilla has its own DPI challenges.

    Do you use custom DPI for the OS? Does it make a difference if you change it?

    If you run Notepad++ from a shortcut, enter its properties and observe compatibility tab. There aren’t as many settings as newer Windows but there is still High DPI related settings that may make a difference.

    See if enabling/disabling Notepad++ option “Use DirectWrite” makes a difference.

    Try playing with your video adapter properties, enabling/disabling 2D optimizations, even if you wouldn’t want to change it permanently, it could help identify the problem area.

  • Deleting content from files also opened in other programs

    13
    0 Votes
    13 Posts
    1k Views
    pnedevP

    @gstavi ,

    I couldn’t agree more. Writing to a file that has been open for writing by another process is definitely not a good idea. That’s why in my initial PR it was forbidden. But your suggestion is really great because this way we still give the user the possibility to overwrite the file while warning him upfront about the write access conflict. Excellent.
    We should distinguish between file open failure due to write sharing violation or write permission failure so we either suggest ‘Force Save’ or ‘Admin Mode Save’. Perhaps GetError will help in that matter.

  • deleting specific lines that don't meet a criteria

    12
    0 Votes
    12 Posts
    1k Views
    Neil SchipperN

    Hi @astrosofista & @guy038 & @alan-kilborn,

    OK, I found some closure on this. When re-running my bookmarking regex I noticed activity in the BookmarksDook panel. If I made the panel invisible, the process was still very slow.

    I also observed that a native bookmarking process like Inverse Bookmark (which has nothing to do with running a regex) was super slow.

    Then I went to a different Npp instance, this one minimalist (no plugins), and ran the regex against the same data, and the process was blink-of-an-eye. I then doubled the data to 2k lines, and it was still pretty much instant.

    Then I took Bookmarks@Dook out of the earlier instance (moved plug-in subdir away, restarted): the bookmarking by regex process was instant. Restored Bookmarks@Dook plugin, slow again.

    So there you have it.

    @alan-kilborn Those threads deal with bookmark processes driven by PythonScript, not native. The two issues might still be related. None of those discussions made mention of the presence or absence of the plugin.

  • How to turn Link into clickable description

    5
    0 Votes
    5 Posts
    26k Views
    NIKKO DE MONTECRISTON

    This is not straightforward, but you could have a table with 2 columns,
    one with the short label (alias) and the other with the real address link and:

    press a defined key to a macro for translating the alias click at the shown link

    Maybe it can be done with only one click,
    if the macro recorder accepts TO
    assign and call the translator macro AND call the final link
    in just one procedure.

    EXAMPLE
    Notepad Macro Shortener& Expander to a web link or a local file

    ALIAS LINK

    link1 file:///C:\Users\myUser\Documents\file1.txt
    link2 http://myURL/file2.txt

    **** Functions *******

    MACRO LINK_UNZIP (define Key1) *******
    INPUT = link1

    search link1

    replace file:///C:\Users\myUser\Documents\file1.txt

    MACRO LINK_ZIP (define Key2) *******
    INPUT = file:///C:\Users\myUser\Documents\file1.txt

    search file:///C:\Users\myUser\Documents\file1.txt

    replace link1

    See the example below:
    sample.png

  • Background :v

    2
    -1 Votes
    2 Posts
    858 Views
    PeterJonesP

    @1338-bang ,

    What part of “text editor” makes you think “background image”?

    There are two interpretations I can see of what you are asking, so the next two paragraphs will reply to those interpretations.

    #1: How to see a background image in Notepad++? Notepad++ is a text editor, not a page layout program. Even if you did convince Notepad++ to show a background image, it would only be for your copy of Notepad++, and not for anyone else using NPP or any other text editor, because text files have no concept of a background image.

    #2: How to get background image in HTML using Notepad++? If you are editing HTML or similar text-based code in Notepad++, that’s something you can do. And if you are asking how to implement a background image in your language of choice, I would reply that you type the appropriate syntax, the same way you type anything in Notepad++. If you have questions about the syntax, that is off topic here, because this Community is about the editor, not the language you happen to be typing with the editor: HTML questions belong in an HTML forum, not a text editor forum, and not the Notepad++ Community Forum in particular.

    Hopefully one of those two will lead you in the right direction.

  • Find a line and copy the next 10 lines

    16
    0 Votes
    16 Posts
    2k Views
    Alan KilbornA

    @neil-schipper

    Wow, Neil, thanks for dealing with THAT, and sparing me. :-)

    @Muthuraj-Madasamy

    Additional good reference on regular expressions (the technique shown above to solve the problem) is found starting HERE.

  • Line feed in a notepad++ file

    4
    0 Votes
    4 Posts
    4k Views
    Neil SchipperN

    @jo-business You didn’t take @alan-kilborn’s advice. Change what you have in the Recherche box to \r\n and you should be fine.

    Also, play with the menu options under View -> Show Symbol (or it’s equivalent in your language) to help you to see what is normally invisible but sometimes important.

    Finally, I’m pretty sure:

    For the moment in the search tab I put : \nThey’re not the only ones.

    is not what you actually typed. Have a look at https://community.notepad-plus-plus.org/topic/21965/please-read-before-posting/1 and learn to use the triple backquote techniques for (mostly) trouble free communication when posting here.

  • Presentation mode?

    5
    0 Votes
    5 Posts
    577 Views
    Alan KilbornA

    @roweryan said in Presentation mode?:

    Maybe this could make it to mainline np++ one day

    It seems perfect as an add-on script.
    Glad that it works for you.

    Now you have a reason to never exit N++.
    If you need such a reason.
    :-)

  • Toolbar displaying all buttons

    8
    0 Votes
    8 Posts
    1k Views
    artie-finkelsteinA

    @deleelee said in Toolbar displaying all buttons:

    Plugins : (most listings deleted) _CustomizeToolbar.dll

    I’m going to guess that Customize Toolbar “lost” it’s configuration file (your_plugins_path)\Config\CustomizeToolbar.dat and it is no longer suppressing the display of some toolbar icons. The .dat file may need to be recreated if it exists but is corrupted. I suggest using the most recent version of the plugin (5.3) as I’ve found it to be much more stable when changing the active Notepad++ executable within the same installation.

  • Find&Replace does not work in UI

    3
    0 Votes
    3 Posts
    261 Views
    Alan KilbornA

    @yang-yongzhao said in Find&Replace does not work in UI:

    the pop window just goes to another monitor

    The Find window remembers where you last put it, so, if this is on another monitor, so be it.

  • 0 Votes
    3 Posts
    349 Views
    Ki AnK

    @alan-kilborn Thank You, Solved :-)

  • Dragging "Find result" window is very slow

    6
  • The auto complete for xml tag is incorrect.

    3
    0 Votes
    3 Posts
    493 Views
    Earth InvaderE

    @michael-vincent You are right. Thanks

  • Possible to replace multiple text instances based on certain parent text?

    7
    0 Votes
    7 Posts
    751 Views
    Shannon GloverS

    @alan-kilborn Thank you. This is what I was anticipating after searching around a bit. I’ll take some time to familiarize myself with this and see if I can get it to work.

  • Mouse Button Shortcuts Fail

    20
    0 Votes
    20 Posts
    2k Views
    NotSoBitWiseN

    @artie-finkelstein
    The Logitech software has been problematic for years. In SetPoint, the toggle setting to control application specific buttons does not persist during system restarts. It also fails to support all the mouse options so you still need to load the Windows mouse utility for some settings. Their newer Logitech Options utility has made things worse since you still need SetPoint AND Windows Mouse for complete control. You have to wonder what their design strategy might be.

  • Character in UTF mode appears as an empty character (stroked square)!

    7
    0 Votes
    7 Posts
    2k Views
    JamesWebbJ

    @peterjones Many thanks. You are pro user (of NP++) and I know nothing about “NP++”!

    I always have checked all “Enable global xxx…” on. I unchecked them and changed “Default Style” (in Style Config) to my specific font and it fixed that :) . The missing characters are shown with that specific font and style.

    Thanks again… It was my headache for a long time.

  • Matching Phone Numbers

    7
    0 Votes
    7 Posts
    683 Views
    Terry RT

    @arthur-schwarez said in Matching Phone Numbers:

    I don’t know if notepad++ is suitable for this purpose.

    In this case I’d say it is suitable.

    We have people asking in this forum for a solution so it makes sense to provide that within the context of using Notepad++, if possible. Certainly sometimes there are applications elsewhere which may do the task just as well, sometimes even better. However it would likely mean the person asking will need to learn yet another thing, something they may not need to ever use again. At least a Notepad++ based solution offers the person asking, some ideas on how Notepad++ may help them with ever increasing complex issues.

    So whilst we try to keep to the Notepad++ theme, solution providers here will sometimes suggest an alternative, especially where Notepad++ is definitely not the best platform.

    Terry

  • 0 Votes
    5 Posts
    2k Views
    Alan KilbornA

    So this critical shortcoming in Notepad++ has come up many times before, and probably even more times than I list here:

    https://community.notepad-plus-plus.org/topic/14644 https://community.notepad-plus-plus.org/topic/15606 https://community.notepad-plus-plus.org/topic/20519 https://community.notepad-plus-plus.org/topic/20584 https://community.notepad-plus-plus.org/topic/20586 https://github.com/notepad-plus-plus/notepad-plus-plus/issues/94 https://github.com/notepad-plus-plus/notepad-plus-plus/issues/760 https://github.com/notepad-plus-plus/notepad-plus-plus/issues/5113 https://github.com/notepad-plus-plus/notepad-plus-plus/issues/8450 https://github.com/notepad-plus-plus/notepad-plus-plus/issues/9584 https://github.com/notepad-plus-plus/notepad-plus-plus/issues/10012

    A few times before when I’ve seen such postings, I’ve thought about sharing my PythonScript method for solving it, but, well, sometimes you have something nice that works for you, but to share it you have to put more “shine” on it. This time I’ve attempted to do that, and I’ve shared the cleaned-up script below.

    Aside: In my response to one of the Community threads above, I see that I promised to post something “soon”. Well, that was back in January of 2021, so “soon” is relative. :-)

    The script works on multiple selection types:

    a normal single stream selection (but why? Just use Notepad++'s own Replace All) column-block selection (the issue posed by the OP to this thread) multiple stream selections (that have been selected with the “Multi-editing” feature of Notepad++ turned on):
    Imgur

    The script is fairly simple to use. Make your selection(s) and then run the script. You will be prompted through a series of dialog boxes to provide your parameters for the replacement operation:

    specifying what you want to find:
    Imgur

    specifying what you want to replace the found matches with:
    Imgur

    specifying other options, like case sensitivity, regular expression mode, etc.:
    Imgur
    To use the options, you put an x inside the brackets in front of an option you want to select; example to select case sensitivity:
    Imgur

    After everything has been specified, press OK and the replacement(s) will be made in the active selection(s).

    If you have chosen the “pre-replace-count-preview” option, you will get a prompt like this before the document text is changed:
    Imgur
    Choosing Yes from there will do the replacing without further prompt.
    Choosing No will result in an additional prompt:
    Imgur

    If you have selected the “post-replacement-summary” option, after replacements have been made, you will see a box like this appear:
    Imgur

    That’s it; here’s the listing for the script, ReplaceAllInSelections.py:

    # -*- coding: utf-8 -*- from Npp import * import re import inspect class RAIS(object): def __init__(self): self.script_name = inspect.getframeinfo(inspect.currentframe()).filename.split('\\')[-1] self.remembered_find_regex_str = '' self.remembered_repl_regex_str = '' self.remembered_case_sens_setting = False self.remembered_whole_word_setting = False self.remembered_regex_setting = False self.remembered_pre_repl_preview_setting = False self.remembered_post_repl_summary_setting = False self.help_str = ''' HELP pre-replace-preview : pops up a box BEFORE replacements are made, telling how many there will be; at that point there will be a way to cancel so that the replacements aren't made; and a way to leave the matches selected post-replace-summary : pops up a box after replacements are made, telling how many were made ''' def mb(self, msg, flags=0, title=''): if len(title) == 0: title = self.script_name return notepad.messageBox(msg, title, flags) def custom_rereplace(self, find_what, replace_with, ignore_case_flag=0, max_num_of_replacements=0, start_end_pos_tup=None): # if start_end_pos_tup is None, replace will be done in all active selections leave_caret_here = None start_end_pos_tup_list = [] if start_end_pos_tup == None: if editor.getSelectionEmpty(): start_end_pos_tup_list.append((0, editor.getTextLength())) leave_caret_here = editor.getCurrentPos() else: for n in range(editor.getSelections()): (s, e) = (editor.getSelectionNStart(n), editor.getSelectionNEnd(n)) append_it = True if 1: # prevent, e.g., a regex search for ^ from replacing "outside" a column-block's visual region # (could happen on empty lines inside the block) if editor.getSelectionNAnchor(n) <= editor.getSelectionNCaret(n): if editor.getSelectionNAnchorVirtualSpace(n) > 0: append_it = False else: if editor.getSelectionNCaretVirtualSpace(n) > 0: append_it = False if append_it: start_end_pos_tup_list.append((s, e)) start_end_pos_tup_list.sort() else: start_end_pos_tup_list.append(start_end_pos_tup) running_offset = 0 first = True if editor.selectionIsRectangle(): # get out of column selection mode as it messes up trying to correctly set selections later editor.setEmptySelection(editor.getCurrentPos()) for (s, e) in start_end_pos_tup_list: s_plus_ro = s + running_offset e_plus_ro = e + running_offset old_len = editor.getLength() editor.rereplace(find_what, replace_with, ignore_case_flag, s_plus_ro, e_plus_ro, max_num_of_replacements) new_len = editor.getLength() if leave_caret_here == None: new_sel_end = e_plus_ro + new_len - old_len if first: editor.setSelection(new_sel_end, s_plus_ro) else: editor.addSelection(new_sel_end, s_plus_ro) running_offset += new_len - old_len first = False if leave_caret_here != None: editor.setEmptySelection(leave_caret_here) def run(self): editor.setMultipleSelection(True) line_ending = ['\r\n', '\r', '\n'][editor.getEOLMode()] num_selections = editor.getSelections() # editor.getSelText() returns...: # skinny caret rect block always returns '' # non-skinny rect block returns line data separated by line-endings # non-skinny rect block totally in virtual space returns only line-endings # example: 3-line rect block in virtual space in windows file returns '\r\n\r\n\r\n' # non-rect multiple-selection text is returned contiguously with no delimiters of any type between! if editor.selectionIsRectangle(): if len(editor.getSelText()) <= num_selections * len(line_ending): self.mb('No text in rectangular selection; nothing to do!') return else: if len(editor.getSelText()) == 0: if num_selections > 1: self.mb('No text in stream selections; nothing to do!') else: self.mb('No selected text; nothing to do!') return find_regex_str = self.remembered_find_regex_str repl_regex_str = self.remembered_repl_regex_str opt_case_sens = 'x' if self.remembered_case_sens_setting else ' ' opt_whole_word = 'x' if self.remembered_whole_word_setting else ' ' opt_regex = 'x' if self.remembered_regex_setting else ' ' opt_pre = 'x' if self.remembered_pre_repl_preview_setting else ' ' opt_post = 'x' if self.remembered_post_repl_summary_setting else ' ' input_stage = 'find' while True: # loop to validate user input if input_stage == 'find': user_reply_to_find_query = notepad.prompt( ' ' * 10 + 'Enter ? alone for help\r\nEnter FIND string:', self.script_name, find_regex_str) if user_reply_to_find_query == None: return # user cancel if len(user_reply_to_find_query) == 0: continue if user_reply_to_find_query == '?': self.mb(self.help_str) continue find_regex_str = user_reply_to_find_query input_stage = 'replace' if input_stage == 'replace': f = find_regex_str[:20] if f != find_regex_str: f += '...' user_reply_to_replace_query = notepad.prompt( ' ' * 5 + 'FIND string = {}\r\nEnter REPLACE string:'.format(f), self.script_name, repl_regex_str) if user_reply_to_replace_query == None: input_stage = 'find'; continue # go back to previous step if len(user_reply_to_replace_query) == 0: ync = self.mb('Replace matches with nothing, effectively deleting them?\r\n\r\n' 'YES = yes, delete matches\r\nNO = prompt again for what to replace with\r\n' 'CANCEL = go back a step (to prompt for find expression)', MESSAGEBOXFLAGS.YESNOCANCEL) if ync == MESSAGEBOXFLAGS.RESULTCANCEL: input_stage = 'find'; continue # go back to previous step elif ync == MESSAGEBOXFLAGS.RESULTNO: continue # repeat current step repl_regex_str = user_reply_to_replace_query input_stage = 'options' if input_stage == 'options': f = find_regex_str[:10] if f != find_regex_str: f += '...' r = repl_regex_str[:10] if r != repl_regex_str: r += '...' options_prompt = '[ {c} ]match-case ' + \ '[ {w} ]whole-word ' + \ '[ {re} ]regular-expression' + \ '\r\n' + \ '[ {pre} ]pre-replace-count-preview ' + \ '[ {post} ]post-replace-summary' options_prompt = options_prompt.format( c=opt_case_sens, w=opt_whole_word, re=opt_regex, pre=opt_pre, post=opt_post) user_reply_to_options_query = notepad.prompt( ' ' * 5 + \ 'FIND string = {} ' + \ 'REPLACE string = {}' + \ '\r\n' + \ 'Select OPTIONS: ' + \ 'Put any character inside the [ ] to select'.format( f, r if len(r) > 0 else 'NOTHING!'), self.script_name, options_prompt) if user_reply_to_options_query == None or len(user_reply_to_options_query) == 0: # go back to previous step input_stage = 'replace' continue if re.sub(r'\\[[^]]+\\]', r'[]', options_prompt) != \ re.sub(r'\\[[^]]+\\]', r'[]', user_reply_to_options_query): self.mb('Trouble parsing the options; please try again') continue options_str = user_reply_to_options_query def check_option(opt): # look in the [ ] boxes; return True if any non-space there m = re.search(r'\\[([^]]+)\\]' + opt, options_str) return True if m and m.group(1) != ' ' * len(m.group(1)) else False doing_case_sensitive = check_option('match-case') doing_whole_word = check_option('whole-word') doing_regex = check_option('regular-expression') doing_pre_replace_preview = check_option('pre-replace-count-preview') doing_post_replace_summary = check_option('post-replace-summary') self.remembered_find_regex_str = find_regex_str self.remembered_repl_regex_str = repl_regex_str self.remembered_case_sens_setting = doing_case_sensitive self.remembered_whole_word_setting = doing_whole_word self.remembered_regex_setting = doing_regex self.remembered_pre_repl_preview_setting = doing_pre_replace_preview self.remembered_post_repl_summary_setting = doing_post_replace_summary if doing_regex: try: editor.research(find_regex_str, lambda _: None) # test regex for validity except RuntimeError as r: self.mb('Error in search regular expression:\r\n\r\n' '{0}\r\n\r\n' '{1}\r\n\r\n\r\n' 'Click OK to try entering your find expression again'.format(find_regex_str, str(r))) input_stage = 'find' continue break total_number_of_matches = 0 if not doing_regex: find_regex_str = r'\Q' + find_regex_str + r'\E' # prevent problems with use of literal parenthesis characters in replace expression: repl_regex_str = re.sub(r'(?<!\\)([()])', r'\\\1', repl_regex_str) # replace parens with backslash-parens if doing_whole_word: find_regex_str = r'\b' + find_regex_str + r'\b' find_regex_str = '(?{}i)'.format('-' if doing_case_sensitive else '') + find_regex_str match_pos_span_tup_list = [] def match_found_func(m): match_pos_span_tup_list.append(m.span(0)) for n in range(editor.getSelections()): editor.research(find_regex_str, match_found_func, 0, editor.getSelectionNStart(n), editor.getSelectionNEnd(n)) total_number_of_matches = len(match_pos_span_tup_list) if total_number_of_matches == 0: self.mb('No matches found for :\r\n\r\n{}'.format(self.remembered_find_regex_str)) return if doing_pre_replace_preview: if self.mb('Make {tnom} replacement{s}?\r\n\r\n' 'Choose NO to not make the replacement{s} and see additional choices'.format( tnom=total_number_of_matches, s='s' if total_number_of_matches > 1 else ''), MESSAGEBOXFLAGS.YESNO) == MESSAGEBOXFLAGS.RESULTNO: if self.mb('End script and leave the {tnom} match{es} {ms}selected?\r\n\r\n' 'Choosing NO will end and leave the original search range selected'.format( tnom=total_number_of_matches, es='es' if total_number_of_matches > 1 else '', ms='multi-' if total_number_of_matches > 1 else ''), MESSAGEBOXFLAGS.YESNO) == MESSAGEBOXFLAGS.RESULTYES: first = True # get out of column selection mode as it messes up trying to correctly set selections later editor.setEmptySelection(match_pos_span_tup_list[0][0]) for (s, e) in match_pos_span_tup_list: editor.setSelection(e, s) if first else editor.addSelection(e, s) first = False return editor.beginUndoAction() self.custom_rereplace(find_regex_str, repl_regex_str) editor.endUndoAction() if not doing_pre_replace_preview and doing_post_replace_summary: self.mb('Replacements made: {}'.format(total_number_of_matches)) if __name__ == '__main__': try: rais except NameError: rais = RAIS() rais.run()
  • Need help please

    3
    0 Votes
    3 Posts
    250 Views
    Terry RT

    @wahlla-magla said in Need help please:

    I want to extract email:pass from every line to be like this

    @PeterJones had the right idea, it’s always difficult when not actually able to test a solution and in this case his will actually erase both user and email fields.
    Instead try
    Find What:(?-s)^.*?:(.+\R?)
    Replace With:\1

    As it’s a regular expression you must have the search mode set to regular expression.

    Terry

  • Cannot set as default app

    4
    0 Votes
    4 Posts
    314 Views
    PeterJonesP

    @roger-emmens said in Cannot set as default app:

    Any suggestions as to what to do?

    It shows up in my list as available for .txt (where it’s already chosen), but not on all others. Maybe because I had used an Windows Explorer > Right Click > Open With > Browse … or equivalent at one point, and/or because I’ve used the registry to manually associate with Notepad++, maybe then the default-app-by-file-type will show Notepad++ now.

    From what I can gather, with every update Windows is trying to make it harder and more annoying to use anything but “windows apps” from the Microsoft Store, so that (like Apple and Android) they can better track what their users are using, and control the experience. Notepad++ flirted with trying to do an official Microsoft Store release some time back, but the hoops they would have to jump through (and, IIRC, limitations that would have broken the existing plugin system) convinced Don that it wasn’t worth the hassle.