From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#9229: 24.0.50; Bidi problem with `cursor' property Date: Wed, 03 Aug 2011 22:13:16 +0300 Message-ID: <837h6upaur.fsf@gnu.org> References: <87sjpi600v.fsf@gnu.org> <83ei12a2n2.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE X-Trace: dough.gmane.org 1312399000 32374 80.91.229.12 (3 Aug 2011 19:16:40 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 3 Aug 2011 19:16:40 +0000 (UTC) Cc: 9229@debbugs.gnu.org To: bojohan@gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Aug 03 21:16:33 2011 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Qogvg-0005ci-Ut for geb-bug-gnu-emacs@m.gmane.org; Wed, 03 Aug 2011 21:16:33 +0200 Original-Received: from localhost ([::1]:53704 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qogvg-0008Hp-AM for geb-bug-gnu-emacs@m.gmane.org; Wed, 03 Aug 2011 15:16:32 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:36310) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qogvc-0008GP-B4 for bug-gnu-emacs@gnu.org; Wed, 03 Aug 2011 15:16:29 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qogvb-0001ZI-IC for bug-gnu-emacs@gnu.org; Wed, 03 Aug 2011 15:16:28 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:36023) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qogvb-0001ZE-Gk for bug-gnu-emacs@gnu.org; Wed, 03 Aug 2011 15:16:27 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1QogwA-0004T5-6f; Wed, 03 Aug 2011 15:17:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 03 Aug 2011 19:17:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 9229 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 9229-submit@debbugs.gnu.org id=B9229.131239897617112 (code B ref 9229); Wed, 03 Aug 2011 19:17:02 +0000 Original-Received: (at 9229) by debbugs.gnu.org; 3 Aug 2011 19:16:16 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QogvQ-0004Rw-LY for submit@debbugs.gnu.org; Wed, 03 Aug 2011 15:16:16 -0400 Original-Received: from mtaout20.012.net.il ([80.179.55.166]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QogvN-0004Rl-R4 for 9229@debbugs.gnu.org; Wed, 03 Aug 2011 15:16:15 -0400 Original-Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0LPD001009EQXK00@a-mtaout20.012.net.il> for 9229@debbugs.gnu.org; Wed, 03 Aug 2011 22:15:18 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([84.228.48.51]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0LPD000NU9HGV2I0@a-mtaout20.012.net.il>; Wed, 03 Aug 2011 22:15:18 +0300 (IDT) In-reply-to: <83ei12a2n2.fsf@gnu.org> X-012-Sender: halo1@inter.net.il X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Wed, 03 Aug 2011 15:17:02 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 1) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:49884 Archived-At: > Date: Wed, 03 Aug 2011 19:19:45 +0300 > From: Eli Zaretskii > Cc: 9229@debbugs.gnu.org >=20 > > From: Johan Bockg=E5rd > > Date: Wed, 03 Aug 2011 16:29:52 +0200 > >=20 > >=20 > > (let ((o (make-overlay (point-max) (point-max))) > > (s (make-string (+ 5 (window-width)) ?-))) > > (put-text-property 0 1 'cursor t s) > > (overlay-put o 'after-string s) > > (goto-char (point-max))) > >=20 > > The cursor is expected to be displayed before the overlay, but is > > displayed after it. > >=20 > > (This bug makes icomplete-mode very confusing to use.) Does the patch below give good results? If it solves this particular problem, please try it in your regular use for a day or two, and see if there are any adverse effects. If you don't spot any trouble, I will install this on the trunk. Thanks. Here's the patch to try: =3D=3D=3D modified file 'src/xdisp.c' --- src/xdisp.c=092011-08-03 05:24:30 +0000 +++ src/xdisp.c=092011-08-03 19:04:49 +0000 @@ -13706,14 +13706,15 @@ set_cursor_from_row (struct window *w, s w->cursor.vpos >=3D 0 /* that candidate is not the row we are processing */ && MATRIX_ROW (matrix, w->cursor.vpos) !=3D row - /* the row we are processing is part of a continued line */ - && (row->continued_p || MATRIX_ROW_CONTINUATION_LINE_P (row)) /* Make sure cursor.vpos specifies a row whose start and end =09 charpos occlude point. This is because some callers of this =09 function leave cursor.vpos at the row where the cursor was =09 displayed during the last redisplay cycle. */ && MATRIX_ROW_START_CHARPOS (MATRIX_ROW (matrix, w->cursor.vpo= s)) <=3D pt_old - && pt_old < MATRIX_ROW_END_CHARPOS (MATRIX_ROW (matrix, w->cur= sor.vpos))) + && (pt_old < MATRIX_ROW_END_CHARPOS (MATRIX_ROW (matrix, w->cu= rsor.vpos)) +=09 /* the entire line is from display string */ +=09 || (pt_old =3D=3D MATRIX_ROW_START_CHARPOS (MATRIX_ROW (matrix,= w->cursor.vpos)) +=09 && pt_old =3D=3D MATRIX_ROW_END_CHARPOS (MATRIX_ROW (matrix= , w->cursor.vpos))))) { struct glyph *g1 =3D =09MATRIX_ROW_GLYPH_START (matrix, w->cursor.vpos) + w->cursor.hpos; @@ -13722,15 +13723,20 @@ set_cursor_from_row (struct window *w, s if (!(row->reversed_p ? glyph > glyphs_end : glyph < glyphs_en= d)) =09return 0; /* Keep the candidate whose buffer position is the closest to -=09 point. */ +=09 point or has the `cursor' property. */ if (/* previous candidate is a glyph in TEXT_AREA of that row = */ =09 w->cursor.hpos >=3D 0 =09 && w->cursor.hpos < MATRIX_ROW_USED (matrix, w->cursor.vpos) -=09 && BUFFERP (g1->object) -=09 && (g1->charpos =3D=3D pt_old /* an exact match always wins */ -=09 || (BUFFERP (glyph->object) -=09=09 && eabs (g1->charpos - pt_old) -=09=09 < eabs (glyph->charpos - pt_old)))) +=09 && ((BUFFERP (g1->object) +=09 && (g1->charpos =3D=3D pt_old /* an exact match always win= s */ +=09=09 || (BUFFERP (glyph->object) +=09=09 && eabs (g1->charpos - pt_old) +=09=09 < eabs (glyph->charpos - pt_old)))) +=09 /* previous candidate is a glyph from a string that has +=09=09 a non-nil `cursor' property */ +=09 || (STRINGP (g1->object) +=09=09 && !NILP (Fget_char_property (make_number (g1->charpos), +=09=09=09=09=09=09Qcursor, g1->object))))) =09return 0; /* If this candidate gives an exact match, use that. */ if (!(BUFFERP (glyph->object) && glyph->charpos =3D=3D pt_old)