bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#342: kill-line sometimes unexpectedly kills invisible text


From: Felix -
Subject: bug#342: kill-line sometimes unexpectedly kills invisible text
Date: Sat, 31 May 2008 13:57:01 -0700

emacs-version "22.2.1"

current line is visible,
next line is invisible,
I move to end of visible line,
then type ctrl-k.
I expect it to kill just the visible newline,
and sometimes it does that,
but sometimes it kills the invisible line too.

what's annoying is, it's inconsistent in an unobvious way.
the behavior depends on what's in the invisible text.

the underlying problem:
kill-line in that case uses forward-visible-line
to find the end of the kill region.

this code demonstrates the forward-visible-line problem:

(with-current-buffer (get-buffer-create "*test*")
  (add-to-invisibility-spec '(foo . t))

  (goto-char (point-max))
  (insert "\n t1: invis ends with newline: abc\n"
          (propertize "def\n ghi\n" 'invisible 'foo)
          "\n jkl\n")
  (search-backward "abc")
  (insert "[")
  (forward-visible-line 1)
  (insert "]")

  (goto-char (point-max))
  (insert "\n t2: invis doesn't end with newline: abc\n"
          (propertize "def\n ghi" 'invisible 'foo)
          "\n jkl\n")
  (search-backward "abc")
  (insert "[")
  (forward-visible-line 1)
  (insert "]")

  (pop-to-buffer (current-buffer))
  )

when I run that, my *test* buffer ends up looking like this:

 t1: invis ends with newline: [abc
...]
 jkl

 t2: invis doesn't end with newline: [abc
]...
 jkl

I don't really care whether it does t1 or t2,
I just want it to be consistently t1 or t2.







reply via email to

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