emacs-devel
[Top][All Lists]
Advanced

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

Re: xdisp.c: Suggestion to delete a few unused lines of code ...


From: Eli Zaretskii
Subject: Re: xdisp.c: Suggestion to delete a few unused lines of code ...
Date: Tue, 28 Apr 2020 22:15:24 +0300

> Date: Tue, 28 Apr 2020 11:46:26 -0700
> From: Keith David Bershatsky <address@hidden>
> 
> In the function display_line within xdisp.c, there is the following code set 
> forth below.  Inasmuch as the first main condition is whether 
> (line_number_needed), the second test within the ELSE IF statement for 
> whether (line_number_needed) will always be negative; i.e., it would have to 
> be negative or else we would never have gotten to the ELSE IF statement ... 
> since the test will always be negative, Emacs will never call 
> maybe_produce_line_number within the ELSE IF section of this code.

I don't understand why you think the test will always be negative in
the second case.  The code is really

  bool line_number_needed = should_produce_line_number (it);

  if (it->current_x < it->first_visible_x + x_incr)
    {
      [...]
      if (line_number_needed)
        maybe_produce_line_number (it);
    }
  else if (it->area == TEXT_AREA)
    {
      if (line_number_needed)
        maybe_produce_line_number (it);
      [...]
    }

What this says that we may need to produce the line numbers both when
we start outside of the visible portion of the window (the 'if'
clause) and when we start inside the visible portion.



reply via email to

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