monnier pushed a commit to branch master
in repository elpa.
commit 7e4dbd71606efa7f41cc1616f613159833fc39f5
Author: Teemu Likonen <[email protected]>
Date: Fri May 22 11:16:00 2009 +0000
Uusi tapa lukea tekstiä ikkunasta
Aiempi toteutus luki ikkunassa näkyviä merkkijonoja "visuaalisesti" ja
rivi kerrallaan. Toiminnan tarkoituksena on hypätä näkymättömien
tekstialueiden yli. Uusi toteutus toimii matalammalla tasolla. Se ei lue
tekstiä visuaalisesti riveittäin, mutta tutkimalla text-properties- ja
overlay-tietoja se hyppää näkymättömien tekstialueiden yli.
---
wcheck-mode.el | 30 +++++++++++++++++-------------
1 files changed, 17 insertions(+), 13 deletions(-)
diff --git a/wcheck-mode.el b/wcheck-mode.el
index 5a0aa57..790e8f7 100644
--- a/wcheck-mode.el
+++ b/wcheck-mode.el
@@ -656,25 +656,29 @@ oikeanlaiset."
(wcheck-query-language-data language 'regexp-end t)))
(syntax (eval (wcheck-query-language-data language 'syntax t)))
+ (w-start (window-start window))
(w-end (window-end window 'update))
+ (buffer (window-buffer window))
(discard (wcheck-query-language-data language 'regexp-discard t))
(case-fold-search nil)
words)
- (move-to-window-line 0)
- (beginning-of-line)
+
(with-syntax-table syntax
- (while (< (point) w-end)
- (while (re-search-forward regexp (line-end-position) t)
- (when (or (equal discard "")
- (not (string-match discard
- (match-string-no-properties 1))))
- (add-to-list 'words
- (match-string-no-properties 1)
- 'append))
- (goto-char (1+ (point))))
- (end-of-line)
- (vertical-motion 1)))
+ (goto-char w-start)
+ (while (re-search-forward regexp w-end t)
+ (cond ((get-char-property (match-beginning 1)
+ 'invisible buffer)
+ (goto-char (next-single-char-property-change
+ (match-beginning 1) 'invisible buffer w-end)))
+
+ ((or (equal discard "")
+ (not (string-match discard
+ (match-string-no-properties 1))))
+ (add-to-list 'words
+ (match-string-no-properties 1)
+ 'append)
+ (goto-char (1+ (point)))))))
words)))))