From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: ptrdiff_t misuse [was :Re: (empty)] Date: Wed, 04 Jul 2012 19:39:36 +0300 Message-ID: <83bojv4h13.fsf@gnu.org> References: <83lij66yq9.fsf@gnu.org> <4FEDB953.1010800@yandex.ru> <4FEEA720.2040405@cs.ucla.edu> <4FEEFBAB.6000404@cs.ucla.edu> <4FF3E1D6.1050103@cs.ucla.edu> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: dough.gmane.org 1341419993 309 80.91.229.3 (4 Jul 2012 16:39:53 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 4 Jul 2012 16:39:53 +0000 (UTC) Cc: dmantipov@yandex.ru, monnier@iro.umontreal.ca, emacs-devel@gnu.org To: Paul Eggert Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jul 04 18:39:52 2012 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1SmScJ-0000Ua-GL for ged-emacs-devel@m.gmane.org; Wed, 04 Jul 2012 18:39:51 +0200 Original-Received: from localhost ([::1]:57142 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SmScI-0001tv-I5 for ged-emacs-devel@m.gmane.org; Wed, 04 Jul 2012 12:39:50 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:55786) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SmScA-0001tb-R5 for emacs-devel@gnu.org; Wed, 04 Jul 2012 12:39:48 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SmSc5-0001ag-Vk for emacs-devel@gnu.org; Wed, 04 Jul 2012 12:39:42 -0400 Original-Received: from mtaout22.012.net.il ([80.179.55.172]:51603) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SmSc5-0001aJ-Ni for emacs-devel@gnu.org; Wed, 04 Jul 2012 12:39:37 -0400 Original-Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0M6N00F00A58ZF00@a-mtaout22.012.net.il> for emacs-devel@gnu.org; Wed, 04 Jul 2012 19:39:36 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([87.69.210.75]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0M6N00EIKA9ZV0I0@a-mtaout22.012.net.il>; Wed, 04 Jul 2012 19:39:36 +0300 (IDT) In-reply-to: <4FF3E1D6.1050103@cs.ucla.edu> X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-Received-From: 80.179.55.172 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:151419 Archived-At: > Date: Tue, 03 Jul 2012 23:25:26 -0700 > From: Paul Eggert > Cc: Dmitry Antipov , emacs-devel@gnu.org > > On 06/30/2012 07:23 AM, Stefan Monnier wrote: > > No, the problem is long lines. > > There's also a problem even if lines are short. > I ran Emacs without the patch, on files with > only short lines, and attempted large horizontal > scroll values (say, most-positive-fixnum minus 100). > The screen would mess up. Sometimes even after I > scrolled back to the left margin, there would be scroll > indicators in the left column. Sometimes there would > be stray characters on the screen. > > To work around this I pushed a patch (trunk bzr 108856) > that arbitrarily ceilings the hscroll value at 100000. I'm quite sure this is the wrong fix, it just sweeps the problem under the carpet. My guess is that, when hscroll is close to INT_MAX, the calculations in display_line, e.g. here: /* Move over display elements that are not visible because we are hscrolled. This may stop at an x-position < IT->first_visible_x if the first glyph is partially visible or if we hit a line end. */ if (it->current_x < it->first_visible_x) { this_line_min_pos = row->start.pos; move_it_in_display_line_to (it, ZV, it->first_visible_x, MOVE_TO_POS | MOVE_TO_X); and in move_it_in_display_line_to this calls, overflow, because these calculations are done in pixels, not in character cells, and so typically (for the default font) manipulate values that are 10 times larger than the hscroll value. So to fix this in the right place, we need to limit the pixel coordinates, not the character cell coordinates. Feel free to fix the problem that way, or leave it to me. But revision 108856 should be reverted. Thanks.