Created
August 26, 2025 21:07
-
-
Save chk1/6177d948ae29b6ba732798c4bacff1c2 to your computer and use it in GitHub Desktop.
Notepad++ PythonScript plugin to convert 'Marks' into cursors/multi-edits
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding: utf-8 -*- | |
| from Npp import editor | |
| # https://community.notepad-plus-plus.org/topic/12710/marked-text-manipulation/48?_=1756239096378 | |
| SCE_UNIVERSAL_FOUND_STYLE = 31 | |
| def mark_to_multi(): | |
| has_marked_items = False | |
| pos = 0 | |
| while pos < editor.getTextLength(): | |
| if editor.indicatorValueAt(SCE_UNIVERSAL_FOUND_STYLE, pos) == 1: | |
| mark_start = editor.indicatorStart(SCE_UNIVERSAL_FOUND_STYLE, pos) | |
| mark_end = editor.indicatorEnd(SCE_UNIVERSAL_FOUND_STYLE, pos) | |
| if editor.getSelectionEmpty() or not editor.getMultipleSelection(): | |
| editor.setSelection(mark_end, mark_start) | |
| else: | |
| editor.addSelection(mark_end, mark_start) | |
| pos = mark_end | |
| has_marked_items = True | |
| editor.setIndicatorCurrent(SCE_UNIVERSAL_FOUND_STYLE) | |
| editor.indicatorClearRange(mark_start, mark_end-mark_start) | |
| pos += 1 | |
| if has_marked_items: | |
| editor.scrollCaret() | |
| mark_to_multi() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment