diff options
author | Vincent Belaïche <vincentb1@users.sourceforge.net> | 2015-12-31 00:10:37 +0100 |
---|---|---|
committer | Vincent Belaïche <vincentb1@users.sourceforge.net> | 2015-12-31 00:10:37 +0100 |
commit | 0c9abf36a4fbc775918c08c1104a64d037280abc (patch) | |
tree | 62cd80cddb9af69b3bd606874d272e47eb6d09ec /lisp/ses.el | |
parent | 209e30bac2d73c2e6f1c46b0d7281b474527cfa4 (diff) | |
download | emacs-0c9abf36a4fbc775918c08c1104a64d037280abc.tar.gz emacs-0c9abf36a4fbc775918c08c1104a64d037280abc.tar.bz2 emacs-0c9abf36a4fbc775918c08c1104a64d037280abc.zip |
Correct ses-rename-cell cursor-intangible text prop updating.
There were two problems:
- First ses-rename-cell has to work when called non interactively
(with non-nil CELL argument), so in this case the start pos of
put-text-property cannot be plainly (point), you need a
ses-goto-print call before
- Second, the range itself was computed erronously, only the first
char was affected instead of the full cell width. This was not
noticeable prior to changes (Deprecate `intangible' and
`point-entered' properties) made by Stefan on 2015-04-13T19:51:15Z
* lisp/ses.el (ses-rename-cell): Correct computation of position range
to which the 'cursor-intangible text property has to be set to cell
new name.
Diffstat (limited to 'lisp/ses.el')
-rw-r--r-- | lisp/ses.el | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/lisp/ses.el b/lisp/ses.el index 8cbc2e80cde..3e35fc10ac6 100644 --- a/lisp/ses.el +++ b/lisp/ses.el @@ -3414,15 +3414,17 @@ highlighted range in the spreadsheet." (setf (ses-cell--symbol cell) new-name) (makunbound sym) (and curcell (setq ses--curcell new-name)) - (let* ((pos (point)) - (inhibit-read-only t) - (col (current-column)) - (end (save-excursion - (move-to-column (1+ col)) - (if (eolp) - (+ pos (ses-col-width col) 1) - (point))))) - (put-text-property pos end 'cursor-intangible new-name)) + (save-excursion + (or curcell (ses-goto-print row col)) + (let* ((pos (point)) + (inhibit-read-only t) + (end (progn + (move-to-column (+ (current-column) (ses-col-width col))) + (if (eolp) + (+ pos (ses-col-width col) 1) + (forward-char) + (point))))) + (put-text-property pos end 'cursor-intangible new-name))) ;; Update the cell name in the mode-line. (force-mode-line-update))) |