[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/hyperbole 128000c5fa 6/7: hyrolo.py (highlight_matches)
From: |
ELPA Syncer |
Subject: |
[elpa] externals/hyperbole 128000c5fa 6/7: hyrolo.py (highlight_matches) - Fix to not change match case |
Date: |
Mon, 16 Jun 2025 03:59:23 -0400 (EDT) |
branch: externals/hyperbole
commit 128000c5fa9354540d19b1559d92c957db89c448
Author: bw <rsw@gnu.org>
Commit: bw <rsw@gnu.org>
hyrolo.py (highlight_matches) - Fix to not change match case
Also add `highlight_re_matches' for future use for regex searching.
---
ChangeLog | 5 +++++
hyrolo.py | 24 +++++++++++++++++++-----
2 files changed, 24 insertions(+), 5 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 08a3ca7b6e..4da35192b8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2025-06-15 Bob Weiner <rsw@gnu.org>
+* hyrolo.py (highlight_matches): Fix so does not change the case of
+ matches found.
+ (highlight_re_matches): Add for future use for regex
+ searching.
+
* hyrolo.el (hyrolo-update-file-list): Add to update 'hyrolo-file-list'
and the cached, fully expanded 'hyrolo--expanded-file-list'.
diff --git a/hyrolo.py b/hyrolo.py
index 5f3b2e656f..9734adc281 100644
--- a/hyrolo.py
+++ b/hyrolo.py
@@ -8,7 +8,7 @@
# Author: Bob Weiner
#
# Orig-Date: 1-Apr-24 at 01:45:27
-# Last-Mod: 1-Sep-24 at 12:25:38 by Bob Weiner
+# Last-Mod: 16-Jun-25 at 00:03:41 by Bob Weiner
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
@@ -144,12 +144,26 @@ def find_matching_entries(match_string, file_paths):
def highlight_matches(match_string, buffer):
- "Split the last buffer into lines and print each line, inverting 'mymatch'
colors."
+ "Split the last buffer into lines and print each line, inverting string
'match' colors."
for b_line in buffer.splitlines():
- if match_string.casefold() in b_line.casefold():
+ lower_b_line, lower_match_string = b_line.lower(), match_string.lower()
+ pos = lower_b_line.find(lower_match_string)
+ match = b_line[pos:pos + len(match_string)] if pos != -1 else None
+ if match:
# Replace the search string with the inverted version
- print(re.sub(re.escape(match_string), invert + match_string +
reset,
- b_line, flags=re.IGNORECASE))
+ print(re.sub(re.escape(match), invert + match + reset, b_line))
+ else:
+ print(b_line)
+
+# Regex search, not yet used; need a flag to switch to regex search
+def highlight_re_matches(match_re, buffer):
+ "Split the last buffer into lines and print each line, inverting regex
'match' colors."
+ for b_line in buffer.splitlines():
+ match_result = re.search(r'(?i)' + match_re, b_line)
+ match = match_result.group() if match_result else None
+ if match:
+ # Replace the search string with the inverted version
+ print(re.sub(re.escape(match), invert + match + reset, b_line))
else:
print(b_line)
- [elpa] externals/hyperbole updated (14707845db -> 4abe195eff), ELPA Syncer, 2025/06/16
- [elpa] externals/hyperbole 128000c5fa 6/7: hyrolo.py (highlight_matches) - Fix to not change match case,
ELPA Syncer <=
- [elpa] externals/hyperbole 4abe195eff 7/7: Merge pull request #749 from rswgnu/rsw, ELPA Syncer, 2025/06/16
- [elpa] externals/hyperbole ab8bde59cd 4/7: Merge pull request #748 from rswgnu/rsw, ELPA Syncer, 2025/06/16
- [elpa] externals/hyperbole ea8dc8dd69 2/7: Merge pull request #747 from rswgnu/rsw, ELPA Syncer, 2025/06/16
- [elpa] externals/hyperbole 0dd5a272a3 5/7: hyrolo-update-file-list - Add to force update to expanded file list, ELPA Syncer, 2025/06/16
- [elpa] externals/hyperbole 4a576b4e7d 1/7: hyrolo.el, hsys-consult.el - Fix/extend HyRolo cmd consult support, ELPA Syncer, 2025/06/16
- [elpa] externals/hyperbole c45c2ffc36 3/7: Remove helm-org-rifle support from HyRolo and regenerate docs, ELPA Syncer, 2025/06/16