emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs/lisp ChangeLog wid-edit.el


From: Glenn Morris
Subject: [Emacs-diffs] emacs/lisp ChangeLog wid-edit.el
Date: Tue, 24 Mar 2009 02:30:27 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Glenn Morris <gm>       09/03/24 02:30:25

Modified files:
        lisp           : ChangeLog wid-edit.el 

Log message:
        (widget-specify-field): Don't add a second overlay for a
        field with just a newline character.
        (widget-field-value-get): Don't reduce fields with just a space
        character to null.
        (character): Accept newline.  (Bug#2689)

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/ChangeLog?cvsroot=emacs&r1=1.15519&r2=1.15520
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/wid-edit.el?cvsroot=emacs&r1=1.198&r2=1.199

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.15519
retrieving revision 1.15520
diff -u -b -r1.15519 -r1.15520
--- ChangeLog   24 Mar 2009 01:42:12 -0000      1.15519
+++ ChangeLog   24 Mar 2009 02:30:15 -0000      1.15520
@@ -1,3 +1,11 @@
+2009-03-24  Glenn Morris  <address@hidden>
+
+       * wid-edit.el (widget-specify-field): Don't add a second overlay for a
+       field with just a newline character.
+       (widget-field-value-get): Don't reduce fields with just a space
+       character to null.
+       (character): Accept newline.  (Bug#2689)
+
 2009-03-24  Kenichi Handa  <address@hidden>
 
        * international/fontset.el (font-encoding-alist): Add an entry for

Index: wid-edit.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/wid-edit.el,v
retrieving revision 1.198
retrieving revision 1.199
diff -u -b -r1.198 -r1.199
--- wid-edit.el 5 Jan 2009 03:19:56 -0000       1.198
+++ wid-edit.el 24 Mar 2009 02:30:22 -0000      1.199
@@ -342,12 +342,16 @@
         (or (not widget-field-add-space) (widget-get widget :size))))
     (if (functionp help-echo)
       (setq help-echo 'widget-mouse-help))
-    (when (= (char-before to) ?\n)
+    (when (and (> to (1+ from))
+              (= (char-before to) ?\n))
       ;; When the last character in the field is a newline, we want to
       ;; give it a `field' char-property of `boundary', which helps the
       ;; C-n/C-p act more naturally when entering/leaving the field.  We
      ;; do this by making a small secondary overlay to contain just that
       ;; one character.
+      ;; We DON'T do this if the field just consists of a newline, eg
+      ;; when specifying a character, since it breaks things (below
+      ;; does 1- to, which results in to = from).  Bug#2689.
       (let ((overlay (make-overlay (1- to) to nil t nil)))
        (overlay-put overlay 'field 'boundary)
         ;; We need the real field for tabbing.
@@ -1945,7 +1949,9 @@
          (set-buffer buffer)
          (while (and size
                      (not (zerop size))
-                     (> to from)
+                     ;; Bug#2689.  Don't allow this loop to reduce a
+                     ;; character field to zero size if it contains a space.
+                     (> to (1+ from))
                      (eq (char-after (1- to)) ?\s))
            (setq to (1- to)))
          (let ((result (buffer-substring-no-properties from to)))
@@ -3450,7 +3456,8 @@
   :value 0
   :size 1
   :format "%{%t%}: %v\n"
-  :valid-regexp "\\`.\\'"
+  ;; `.' does not match newline, but newline is a valid character.
+  :valid-regexp "\\`\\(.\\|\n\\)\\'"
   :error "This field should contain a single character"
   :value-to-internal (lambda (widget value)
                       (if (stringp value)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]