[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 524047e 163/215: Fix file-column-to-string in the presence
From: |
Rocky Bernstein |
Subject: |
[elpa] master 524047e 163/215: Fix file-column-to-string in the presence of composed characters |
Date: |
Sat, 30 Jul 2016 14:49:02 +0000 (UTC) |
branch: master
commit 524047e229e00f5adfe69c31c73905d8b227f67b
Author: Clément Pit--Claudel <address@hidden>
Commit: Clément Pit--Claudel <address@hidden>
Fix file-column-to-string in the presence of composed characters
(- (current-column) (length source-text)) is not necessarily a valid
source position: indeed, when a line contains composed characters, these
characters do not count towards column numbers; thus, the largest column
on a line containing n characters can be < n, and thus the existing code
could return negative column numbers.
Concrete example: starting trepan2 on a buffer created by the following
snippet would cause realgud to crash:
(with-current-buffer (get-buffer-create "*python-prettified*")
(python-mode)
(erase-buffer)
(setq-local prettify-symbols-alist '(("in" . ?∈)))
(insert "for x in [1,2,3]:\n pass")
(prettify-symbols-mode)
(pop-to-buffer (current-buffer)))
---
realgud/common/file.el | 28 ++++++++++++----------------
1 file changed, 12 insertions(+), 16 deletions(-)
diff --git a/realgud/common/file.el b/realgud/common/file.el
index b4c378c..5bbf8ee 100644
--- a/realgud/common/file.el
+++ b/realgud/common/file.el
@@ -29,22 +29,18 @@ found"
"Return the column of the first column position of SOURCE-TEXT
at LINE-NUMBER or nil if it is not there"
(condition-case nil
- (if (file-exists-p filename)
- (let ((file-buffer (find-file-noselect filename)))
- (with-current-buffer-safe file-buffer
- (save-excursion
- (goto-char (point-min))
- (forward-line (1- line-number))
- (unless no-strip-blanks
- (setq source-text (realgud:strip source-text)))
- (if (search-forward source-text (point-at-eol))
- (- (current-column)
- (length source-text))))))
- ;; else
- nil)
- (error nil))
-)
-
+ (when (and source-text (file-exists-p filename))
+ (let ((file-buffer (find-file-noselect filename)))
+ (with-current-buffer-safe file-buffer
+ (save-excursion
+ (goto-char (point-min))
+ (forward-line (1- line-number))
+ (unless no-strip-blanks
+ (setq source-text (realgud:strip source-text)))
+ (when (search-forward source-text (point-at-eol))
+ (goto-char (match-beginning 0))
+ (current-column))))))
+ (error nil)))
;; FIXME: should allow column number to be passed in.
(defun realgud:file-loc-from-line(filename line-number
- [elpa] master c919f96 115/215: Update IPDB in accordance with PDB, (continued)
- [elpa] master c919f96 115/215: Update IPDB in accordance with PDB, Rocky Bernstein, 2016/07/30
- [elpa] master 9358b1b 144/215: Merge pull request #104 from rocky/36-auto-attach, Rocky Bernstein, 2016/07/30
- [elpa] master 480cbb3 159/215: Remove leftover debugging message, Rocky Bernstein, 2016/07/30
- [elpa] master b2c9e67 156/215: Allow realgud-track-bp-delete to recognize multiple breakpoints, Rocky Bernstein, 2016/07/30
- [elpa] master c522acc 158/215: Merge pull request #110 from rocky/delete-multiple-breakpoints, Rocky Bernstein, 2016/07/30
- [elpa] master be7718a 073/215: Go over perldb init re's. Attempt smaller cleanup of tests and note how, Rocky Bernstein, 2016/07/30
- [elpa] master f08a894 170/215: Ensure that the Github organization logo is a square, Rocky Bernstein, 2016/07/30
- [elpa] master 6e72375 160/215: Merge pull request #111 from rocky/better-breakpoint-highlighting, Rocky Bernstein, 2016/07/30
- [elpa] master a89d1b2 149/215: Rewrite README, Rocky Bernstein, 2016/07/30
- [elpa] master 90068ea 201/215: Simpler change to previous commit, Rocky Bernstein, 2016/07/30
- [elpa] master 524047e 163/215: Fix file-column-to-string in the presence of composed characters,
Rocky Bernstein <=
- [elpa] master 4118834 207/215: Suppress irrelevant compilation warnings, Rocky Bernstein, 2016/07/30
- [elpa] master 0a17ada 079/215: Fix several issues when calling gdb, Fixes #59, Rocky Bernstein, 2016/07/30
- [elpa] master bc1f4ba 194/215: Broaden trepan breakpoint search, Rocky Bernstein, 2016/07/30
- [elpa] master 277e10c 167/215: Merge pull request #113 from rocky/logo, Rocky Bernstein, 2016/07/30
- [elpa] master 7211cc5 192/215: Restart should be a confirm command too., Rocky Bernstein, 2016/07/30
- [elpa] master 32fb382 190/215: Merge pull request #126 from realgud/103-jump, Rocky Bernstein, 2016/07/30
- [elpa] master ba2b69c 202/215: Remove code added by mistake, Rocky Bernstein, 2016/07/30
- [elpa] master 4862a6f 206/215: Warn if gdb --interpreter=mi or -i mi is used, Rocky Bernstein, 2016/07/30
- [elpa] master 1e257cf 209/215: One more FSF copyright assignment, Rocky Bernstein, 2016/07/30
- [elpa] master ba3b013 103/215: Merge branch 'ipdb' of https://github.com/seanfarley/emacs-dbgr into ipdb, Rocky Bernstein, 2016/07/30