all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: gustav.erik@gmail.com
Cc: emacs-devel@gnu.org
Subject: Re: BUG: Emacs crashes due to org-mode parameter org-indent-mode
Date: Fri, 23 Dec 2011 16:57:36 +0200	[thread overview]
Message-ID: <83wr9nxrmn.fsf@gnu.org> (raw)
In-Reply-To: <831urvzixf.fsf@gnu.org>

> Date: Fri, 23 Dec 2011 12:22:36 +0200
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: emacs-devel@gnu.org
> 
> > Date: Fri, 23 Dec 2011 09:37:08 +0100
> > From: Gustav Wikström <gustav.erik@gmail.com>
> > Cc: emacs-devel@gnu.org
> > 
> > Missed one step in the reproduce-description, see now.
> > [...]
> > > > - Start emacs without any initial settings (runemacs.exe -q)
> > > > - Open an org-mode file
> > > > - M-x org-indent-mode
> > > > - C-c C-x b on a heading in the file
> > >
> > 
> > - C-x 0 (close the direct buffer to make the indirect buffer the default
> > one)
> > 
> > 
> > > > - tab
> 
> OK, now I can reproduce this, thanks.  It's a display-related bug, I
> will look into it.

Fixed in revision 106726 on the trunk.  If you can build your own
Emacs, the patch is below.

I saw no bug report yet, but when I see it, I will close it with this
information.

Thanks.

=== modified file 'src/xdisp.c'
--- src/xdisp.c	2011-12-10 19:54:45 +0000
+++ src/xdisp.c	2011-12-23 14:51:51 +0000
@@ -4090,10 +4090,11 @@ handle_invisible_prop (struct it *it)
 	  while (invis_p);
 
 	  /* The position newpos is now either ZV or on visible text.  */
-	  if (it->bidi_p && newpos < ZV)
+	  if (it->bidi_p)
 	    {
 	      EMACS_INT bpos = CHAR_TO_BYTE (newpos);
-	      int on_newline = FETCH_BYTE (bpos) == '\n';
+	      int on_newline =
+		bpos == ZV_BYTE || FETCH_BYTE (bpos) == '\n';
 	      int after_newline =
 		newpos <= BEGV || FETCH_BYTE (bpos - 1) == '\n';
 
@@ -4111,16 +4112,16 @@ handle_invisible_prop (struct it *it)
 
 		  SET_TEXT_POS (tpos, newpos, bpos);
 		  reseat_1 (it, tpos, 0);
-		  /* If we reseat on a newline, we need to prep the
+		  /* If we reseat on a newline/ZV, we need to prep the
 		     bidi iterator for advancing to the next character
-		     after the newline, keeping the current paragraph
+		     after the newline/EOB, keeping the current paragraph
 		     direction (so that PRODUCE_GLYPHS does TRT wrt
 		     prepending/appending glyphs to a glyph row).  */
 		  if (on_newline)
 		    {
 		      it->bidi_it.first_elt = 0;
 		      it->bidi_it.paragraph_dir = pdir;
-		      it->bidi_it.ch = '\n';
+		      it->bidi_it.ch = (bpos == ZV_BYTE) ? -1 : '\n';
 		      it->bidi_it.nchars = 1;
 		      it->bidi_it.ch_len = 1;
 		    }





      parent reply	other threads:[~2011-12-23 14:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-22 23:04 BUG: Emacs crashes due to org-mode parameter org-indent-mode Gustav Wikström
2011-12-23  8:23 ` Eli Zaretskii
2011-12-23  8:37   ` Gustav Wikström
2011-12-23 10:22     ` Eli Zaretskii
2011-12-23 12:27       ` Bastien
2011-12-23 14:57       ` Eli Zaretskii [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83wr9nxrmn.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=gustav.erik@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.