emacs-devel
[Top][All Lists]
Advanced

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

Re: visual-line-mode


From: Chong Yidong
Subject: Re: visual-line-mode
Date: Fri, 11 Jul 2008 17:10:05 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

Stefan Monnier <address@hidden> writes:

> PS: My patch is just a proof of concept.  It has a few bugs.  One of
> them can be seen when you set truncate-lines, in which case it doesn't
> preserve columns correctly (basically, its temporary-goal-column ends
> up being computed from the beginning of the displayed part of the line,
> so as long as hscroll is not changed, it works OK but as soon as
> hscroll is modified, the result is incorrect).

Does the following patch give good results/make sense?

*** trunk/src/indent.c.~1.209.~ 2008-06-29 09:56:50.000000000 -0400
--- trunk/src/indent.c  2008-07-11 17:08:33.000000000 -0400
***************
*** 2058,2067 ****
--- 2058,2070 ----
        int it_start;
        int oselective;
        int it_overshoot_expected;
+       int first_x;
  
        SET_TEXT_POS (pt, PT, PT_BYTE);
        start_display (&it, w, pt);
  
+       first_x = it.first_visible_x;
+ 
        /* Scan from the start of the line containing PT.  If we don't
         do this, we start moving with IT->current_x == 0, while PT is
         really at some x > 0.  The effect is, in continuation lines, that
***************
*** 2119,2128 ****
        move_it_by_lines (&it, XINT (lines), 0);
  
        if (!NILP (lcols))
!       move_it_in_display_line
!         (&it, ZV,
!          (int)(cols * FRAME_COLUMN_WIDTH (XFRAME (w->frame)) + 0.5),
!          MOVE_TO_X);
  
        SET_PT_BOTH (IT_CHARPOS (it), IT_BYTEPOS (it));
      }
--- 2122,2135 ----
        move_it_by_lines (&it, XINT (lines), 0);
  
        if (!NILP (lcols))
!       {
!         move_it_in_display_line (&it, ZV, first_x, MOVE_TO_X);
!         it.current_x = 0;
!         move_it_in_display_line
!           (&it, ZV,
!            (int)(cols * FRAME_COLUMN_WIDTH (XFRAME (w->frame)) + 0.5),
!            MOVE_TO_X);
!       }
  
        SET_PT_BOTH (IT_CHARPOS (it), IT_BYTEPOS (it));
      }




reply via email to

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