Title: editor.research() and editor.search() won't search backwards · Issue #323 · bruderstein/PythonScript · GitHub
Open Graph Title: editor.research() and editor.search() won't search backwards · Issue #323 · bruderstein/PythonScript
X Title: editor.research() and editor.search() won't search backwards · Issue #323 · bruderstein/PythonScript
Description: Under PS 3.0.16.0 (and 2.0.0.0 as well), editor.research() and editor.search() won't search backwards, i.e., when the startPosition argument is greater than the endPosition argument. It return no matches in such a case. Here is a script ...
Open Graph Description: Under PS 3.0.16.0 (and 2.0.0.0 as well), editor.research() and editor.search() won't search backwards, i.e., when the startPosition argument is greater than the endPosition argument. It return no m...
X Description: Under PS 3.0.16.0 (and 2.0.0.0 as well), editor.research() and editor.search() won't search backwards, i.e., when the startPosition argument is greater than the endPosition argument. It return ...
Opengraph URL: https://github.com/bruderstein/PythonScript/issues/323
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"editor.research() and editor.search() won't search backwards","articleBody":"Under PS 3.0.16.0 (and 2.0.0.0 as well), `editor.research()` and `editor.search()` won't search backwards, i.e., when the `startPosition` argument is greater than the `endPosition` argument. It return no matches in such a case.\r\n\r\nHere is a script which demonstrates the problem, when the script is executed to act upon its own code as input data in the active editor tab in N++:\r\n\r\n```py\r\n# -*- coding: utf-8 -*-\r\nfrom __future__ import print_function\r\n\r\nfrom Npp import *\r\n\r\npos1 = 0; pos2 = editor.getLength() # forward search, i.e., pos1 \u003c pos2\r\n(pos1, pos2) = (pos2, pos1) # swap to do backward search\r\n\r\nmatches = []\r\neditor.research('a', lambda m: matches.append(m.span(0)), 0, pos1, pos2)\r\nprint('research:', matches[0]) if len(matches) > 0 else print('research: no matches')\r\n\r\n# show that editor.findText() works fine either forward or backward:\r\nft_pos_tup = editor.findText(FINDOPTION.REGEXP, pos1, pos2, 'a')\r\nprint('ft_pos_tup:|{T}|'.format(T=ft_pos_tup))\r\n```\r\n\r\nTo see the problem, run the script as written. To see that the script logic works for a forward search, comment out the \"swap\" line. Note that a call to `editor.findText()` is included to show that it works correctly for either backward or forward searches.","author":{"url":"https://github.com/alankilborn","@type":"Person","name":"alankilborn"},"datePublished":"2024-01-23T16:11:29Z","url":"https://github.com/bruderstein/PythonScript/issues/323"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:b3dd9297-c370-de34-0416-590150d375e3 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E802:23AF91:25576EB:30C1D4B:6AF9907A |
| html-safe-nonce | 10c8bc344fe8dc4ed6ff9594de295609a5bd88126408b2114289ea43b2df2f8f |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFODAyOjIzQUY5MToyNTU3NkVCOjMwQzFENEI6NkFGOTkwN0EiLCJ2aXNpdG9yX2lkIjoiODgxNjA5MDE1MDE4NzU0MTcxIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 80146a1fbf725a2eec8c36208b9536df3994fd18acdebc35223d6303280b8c89 |
| hovercard-subject-tag | issue:2096439400 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/bruderstein/PythonScript/323/issue_layout |
| twitter:image | https://opengraph.githubassets.com/928757bdaf6be0813d76a1a1aeadfe5ef1609407c2312ae4e684919b0282c9e9/bruderstein/PythonScript/issues/323 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/928757bdaf6be0813d76a1a1aeadfe5ef1609407c2312ae4e684919b0282c9e9/bruderstein/PythonScript/issues/323 |
| og:image:alt | Under PS 3.0.16.0 (and 2.0.0.0 as well), editor.research() and editor.search() won't search backwards, i.e., when the startPosition argument is greater than the endPosition argument. It return no m... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | alankilborn |
| hostname | github.com |
| expected-hostname | github.com |
| None | 612d3e6ffd693e7ea8d9fcf452370995872baef31d825b1fedef704cd3d24ac7 |
| turbo-cache-control | no-preview |
| go-import | github.com/bruderstein/PythonScript git https://github.com/bruderstein/PythonScript.git |
| octolytics-dimension-user_id | 91716 |
| octolytics-dimension-user_login | bruderstein |
| octolytics-dimension-repository_id | 795778 |
| octolytics-dimension-repository_nwo | bruderstein/PythonScript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 795778 |
| octolytics-dimension-repository_network_root_nwo | bruderstein/PythonScript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 072e34035c13c31543fba9f025cbbbda4210dae4 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width