unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Problem report #6
@ 2006-04-10 18:46 Dan Nicolaescu
  2006-04-21 16:09 ` Dan Nicolaescu
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Nicolaescu @ 2006-04-10 18:46 UTC (permalink / raw)



Thanks to everyone that analyzed the previous batch of problem reports
posted. I updated their status.

Of the remaining unanalyzed reports 35 are for files in emacs/src/*,
I'll post those first.

CID: 6
Checker: DEADCODE (help)
File: emacs/src/xdisp.c
Function: try_window_id
Description: After this line, the value of "last_text_row_at_end" is equal to 0

file: emacs/src/xdisp.c

Event assignment: Assigning "0" to "last_text_row"
Also see events: [dead_error_line][dead_error_condition][const][assignment][new_values][new_values][dead_error_condition][const][new_values][dead_error_condition][assignment][new_values][const]

14392	  last_text_row = NULL;
14393	  overlay_arrow_seen = 0;
14394	  while (it.current_y < it.last_visible_y
14395		 && !fonts_changed_p
14396		 && (first_unchanged_at_end_row == NULL
14397		     || IT_CHARPOS (it) < stop_pos))
14398	    {
14399	      if (display_line (&it))
14400		last_text_row = it.glyph_row - 1;
14401	    }
14402	
14403	  if (fonts_changed_p)
14404	    return -1;
14405	
14406	
14407	  /* Compute differences in buffer positions, y-positions etc.  for
14408	     lines reused at the bottom of the window.  Compute what we can
14409	     scroll.  */
14410	  if (first_unchanged_at_end_row
14411	      /* No lines reused because we displayed everything up to the
14412	         bottom of the window.  */
14413	      && it.current_y < it.last_visible_y)
14414	    {
14415	      dvpos = (it.vpos
14416		       - MATRIX_ROW_VPOS (first_unchanged_at_end_row,
14417					  current_matrix));
14418	      dy = it.current_y - first_unchanged_at_end_row->y;
14419	      run.current_y = first_unchanged_at_end_row->y;
14420	      run.desired_y = run.current_y + dy;
14421	      run.height = it.last_visible_y - max (run.current_y, run.desired_y);
14422	    }
14423	  else
14424	    {
14425	      delta = dvpos = dy = run.current_y = run.desired_y = run.height = 0;

Event assignment: Assigning "0" to "first_unchanged_at_end_row"
Also see events: [dead_error_line][dead_error_condition][const][new_values][new_values][dead_error_condition][assignment][const][new_values][dead_error_condition][assignment][new_values][const]

14426	      first_unchanged_at_end_row = NULL;
14427	    }
14428	  IF_DEBUG (debug_dvpos = dvpos; debug_dy = dy);
14429	
14430	
14431	  /* Find the cursor if not already found.  We have to decide whether
14432	     PT will appear on this window (it sometimes doesn't, but this is
14433	     not a very frequent case.)  This decision has to be made before
14434	     the current matrix is altered.  A value of cursor.vpos < 0 means
14435	     that PT is either in one of the lines beginning at
14436	     first_unchanged_at_end_row or below the window.  Don't care for
14437	     lines that might be displayed later at the window end; as
14438	     mentioned, this is not a frequent case.  */
14439	  if (w->cursor.vpos < 0)
14440	    {
14441	      /* Cursor in unchanged rows at the top?  */
14442	      if (PT < CHARPOS (start_pos)
14443		  && last_unchanged_at_beg_row)
14444		{
14445		  row = row_containing_pos (w, PT,
14446					    MATRIX_FIRST_TEXT_ROW (w->current_matrix),
14447					    last_unchanged_at_beg_row + 1, 0);
14448		  if (row)
14449		    set_cursor_from_row (w, row, w->current_matrix, 0, 0, 0, 0);
14450		}
14451	
14452	      /* Start from first_unchanged_at_end_row looking for PT.  */
14453	      else if (first_unchanged_at_end_row)
14454		{
14455		  row = row_containing_pos (w, PT - delta,
14456					    first_unchanged_at_end_row, NULL, 0);
14457		  if (row)
14458		    set_cursor_from_row (w, row, w->current_matrix, delta,
14459					 delta_bytes, dy, dvpos);
14460		}
14461	
14462	      /* Give up if cursor was not found.  */
14463	      if (w->cursor.vpos < 0)
14464		{
14465		  clear_glyph_matrix (w->desired_matrix);
14466		  return -1;
14467		}
14468	    }
14469	
14470	  /* Don't let the cursor end in the scroll margins.  */
14471	  {
14472	    int this_scroll_margin, cursor_height;
14473	
14474	    this_scroll_margin = max (0, scroll_margin);
14475	    this_scroll_margin = min (this_scroll_margin, WINDOW_TOTAL_LINES (w) / 4);
14476	    this_scroll_margin *= FRAME_LINE_HEIGHT (it.f);
14477	    cursor_height = MATRIX_ROW (w->desired_matrix, w->cursor.vpos)->height;
14478	
14479	    if ((w->cursor.y < this_scroll_margin
14480		 && CHARPOS (start) > BEGV)
14481		/* Old redisplay didn't take scroll margin into account at the bottom,
14482		   but then global-hl-line-mode doesn't scroll.  KFS 2004-06-14 */
14483		|| (w->cursor.y + (make_cursor_line_fully_visible_p
14484				   ? cursor_height + this_scroll_margin
14485				   : 1)) > it.last_visible_y)
14486	      {
14487		w->cursor.vpos = -1;
14488		clear_glyph_matrix (w->desired_matrix);
14489		return -1;
14490	      }
14491	  }
14492	
14493	  /* Scroll the display.  Do it before changing the current matrix so
14494	     that xterm.c doesn't get confused about where the cursor glyph is
14495	     found.  */
14496	  if (dy && run.height)
14497	    {
14498	      update_begin (f);
14499	
14500	      if (FRAME_WINDOW_P (f))
14501		{
14502		  rif->update_window_begin_hook (w);
14503		  rif->clear_window_mouse_face (w);
14504		  rif->scroll_run_hook (w, &run);
14505		  rif->update_window_end_hook (w, 0, 0);
14506		}
14507	      else
14508		{
14509		  /* Terminal frame.  In this case, dvpos gives the number of
14510		     lines to scroll by; dvpos < 0 means scroll up.  */
14511		  int first_unchanged_at_end_vpos
14512		    = MATRIX_ROW_VPOS (first_unchanged_at_end_row, w->current_matrix);
14513		  int from = WINDOW_TOP_EDGE_LINE (w) + first_unchanged_at_end_vpos;
14514		  int end = (WINDOW_TOP_EDGE_LINE (w)
14515			     + (WINDOW_WANTS_HEADER_LINE_P (w) ? 1 : 0)
14516			     + window_internal_height (w));
14517	
14518		  /* Perform the operation on the screen.  */
14519		  if (dvpos > 0)
14520		    {
14521		      /* Scroll last_unchanged_at_beg_row to the end of the
14522			 window down dvpos lines.  */
14523		      set_terminal_window (end);
14524	
14525		      /* On dumb terminals delete dvpos lines at the end
14526			 before inserting dvpos empty lines.  */
14527		      if (!scroll_region_ok)
14528			ins_del_lines (end - dvpos, -dvpos);
14529	
14530		      /* Insert dvpos empty lines in front of
14531	                 last_unchanged_at_beg_row.  */
14532		      ins_del_lines (from, dvpos);
14533		    }
14534		  else if (dvpos < 0)
14535		    {
14536		      /* Scroll up last_unchanged_at_beg_vpos to the end of
14537			 the window to last_unchanged_at_beg_vpos - |dvpos|.  */
14538		      set_terminal_window (end);
14539	
14540		      /* Delete dvpos lines in front of
14541			 last_unchanged_at_beg_vpos.  ins_del_lines will set
14542			 the cursor to the given vpos and emit |dvpos| delete
14543			 line sequences.  */
14544		      ins_del_lines (from + dvpos, dvpos);
14545	
14546		      /* On a dumb terminal insert dvpos empty lines at the
14547	                 end.  */
14548		      if (!scroll_region_ok)
14549			ins_del_lines (end + dvpos, -dvpos);
14550		    }
14551	
14552		  set_terminal_window (0);
14553		}
14554	
14555	      update_end (f);
14556	    }
14557	
14558	  /* Shift reused rows of the current matrix to the right position.
14559	     BOTTOM_ROW is the last + 1 row in the current matrix reserved for
14560	     text.  */
14561	  bottom_row = MATRIX_BOTTOM_TEXT_ROW (current_matrix, w);
14562	  bottom_vpos = MATRIX_ROW_VPOS (bottom_row, current_matrix);
14563	  if (dvpos < 0)
14564	    {
14565	      rotate_matrix (current_matrix, first_unchanged_at_end_vpos + dvpos,
14566			     bottom_vpos, dvpos);
14567	      enable_glyph_matrix_rows (current_matrix, bottom_vpos + dvpos,
14568					bottom_vpos, 0);
14569	    }
14570	  else if (dvpos > 0)
14571	    {
14572	      rotate_matrix (current_matrix, first_unchanged_at_end_vpos,
14573			     bottom_vpos, dvpos);
14574	      enable_glyph_matrix_rows (current_matrix, first_unchanged_at_end_vpos,
14575					first_unchanged_at_end_vpos + dvpos, 0);
14576	    }
14577	
14578	  /* For frame-based redisplay, make sure that current frame and window
14579	     matrix are in sync with respect to glyph memory.  */
14580	  if (!FRAME_WINDOW_P (f))
14581	    sync_frame_with_window_matrix_rows (w);
14582	
14583	  /* Adjust buffer positions in reused rows.  */
14584	  if (delta)
14585	    increment_matrix_positions (current_matrix,
14586					first_unchanged_at_end_vpos + dvpos,
14587					bottom_vpos, delta, delta_bytes);
14588	
14589	  /* Adjust Y positions.  */
14590	  if (dy)
14591	    shift_glyph_matrix (w, current_matrix,
14592				first_unchanged_at_end_vpos + dvpos,
14593				bottom_vpos, dy);
14594	

Event new_values: Conditional "first_unchanged_at_end_row != 0"
Also see events: [dead_error_line][dead_error_condition][const][assignment][new_values][dead_error_condition][assignment][const][new_values][dead_error_condition][assignment][new_values][const]

14595	  if (first_unchanged_at_end_row)
14596	    {
14597	      first_unchanged_at_end_row += dvpos;
14598	      if (first_unchanged_at_end_row->y >= it.last_visible_y
14599		  || !MATRIX_ROW_DISPLAYS_TEXT_P (first_unchanged_at_end_row))
14600		first_unchanged_at_end_row = NULL;
14601	    }
14602	
14603	  /* If scrolling up, there may be some lines to display at the end of
14604	     the window.  */

Event assignment: Assigning "0" to "last_text_row_at_end"
Also see events: [dead_error_line][dead_error_condition][const][assignment][new_values][new_values][dead_error_condition][assignment][const][new_values][dead_error_condition][new_values][const]

14605	  last_text_row_at_end = NULL;
14606	  if (dy < 0)
14607	    {
14608	      /* Scrolling up can leave for example a partially visible line
14609		 at the end of the window to be redisplayed.  */
14610	      /* Set last_row to the glyph row in the current matrix where the
14611		 window end line is found.  It has been moved up or down in
14612		 the matrix by dvpos.  */
14613	      int last_vpos = XFASTINT (w->window_end_vpos) + dvpos;
14614	      struct glyph_row *last_row = MATRIX_ROW (current_matrix, last_vpos);
14615	
14616	      /* If last_row is the window end line, it should display text.  */
14617	      xassert (last_row->displays_text_p);
14618	
14619	      /* If window end line was partially visible before, begin
14620		 displaying at that line.  Otherwise begin displaying with the
14621		 line following it.  */
14622	      if (MATRIX_ROW_BOTTOM_Y (last_row) - dy >= it.last_visible_y)
14623		{
14624		  init_to_row_start (&it, w, last_row);
14625		  it.vpos = last_vpos;
14626		  it.current_y = last_row->y;
14627		}
14628	      else
14629		{
14630		  init_to_row_end (&it, w, last_row);
14631		  it.vpos = 1 + last_vpos;
14632		  it.current_y = MATRIX_ROW_BOTTOM_Y (last_row);
14633		  ++last_row;
14634		}
14635	
14636	      /* We may start in a continuation line.  If so, we have to
14637		 get the right continuation_lines_width and current_x.  */
14638	      it.continuation_lines_width = last_row->continuation_lines_width;
14639	      it.hpos = it.current_x = 0;
14640	
14641	      /* Display the rest of the lines at the window end.  */
14642	      it.glyph_row = MATRIX_ROW (desired_matrix, it.vpos);
14643	      while (it.current_y < it.last_visible_y
14644		     && !fonts_changed_p)
14645		{
14646		  /* Is it always sure that the display agrees with lines in
14647		     the current matrix?  I don't think so, so we mark rows
14648		     displayed invalid in the current matrix by setting their
14649		     enabled_p flag to zero.  */
14650		  MATRIX_ROW (w->current_matrix, it.vpos)->enabled_p = 0;
14651		  if (display_line (&it))
14652		    last_text_row_at_end = it.glyph_row - 1;
14653		}
14654	    }
14655	
14656	  /* Update window_end_pos and window_end_vpos.  */

Event const: After this line, the value of "first_unchanged_at_end_row" is equal to 0
Event new_values: Conditional "first_unchanged_at_end_row != 0"
Also see events: [dead_error_line][dead_error_condition][assignment][new_values][new_values][dead_error_condition][assignment][const][new_values][dead_error_condition][assignment][new_values][const]

14657	  if (first_unchanged_at_end_row
14658	      && !last_text_row_at_end)
14659	    {
14660	      /* Window end line if one of the preserved rows from the current
14661		 matrix.  Set row to the last row displaying text in current
14662		 matrix starting at first_unchanged_at_end_row, after
14663		 scrolling.  */
14664	      xassert (first_unchanged_at_end_row->displays_text_p);
14665	      row = find_last_row_displaying_text (w->current_matrix, &it,
14666						   first_unchanged_at_end_row);
14667	      xassert (row && MATRIX_ROW_DISPLAYS_TEXT_P (row));
14668	
14669	      w->window_end_pos = make_number (Z - MATRIX_ROW_END_CHARPOS (row));
14670	      w->window_end_bytepos = Z_BYTE - MATRIX_ROW_END_BYTEPOS (row);
14671	      w->window_end_vpos
14672		= make_number (MATRIX_ROW_VPOS (row, w->current_matrix));
14673	      xassert (w->window_end_bytepos >= 0);
14674	      IF_DEBUG (debug_method_add (w, "A"));
14675	    }

Event new_values: Conditional "last_text_row_at_end != 0"
Event const: After this line, the value of "last_text_row_at_end" is equal to 0
Also see events: [dead_error_line][dead_error_condition][const][assignment][new_values][new_values][dead_error_condition][assignment][const][new_values][dead_error_condition][assignment][const]

14676	  else if (last_text_row_at_end)
14677	    {
14678	      w->window_end_pos
14679		= make_number (Z - MATRIX_ROW_END_CHARPOS (last_text_row_at_end));
14680	      w->window_end_bytepos
14681		= Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_text_row_at_end);
14682	      w->window_end_vpos
14683		= make_number (MATRIX_ROW_VPOS (last_text_row_at_end, desired_matrix));
14684	      xassert (w->window_end_bytepos >= 0);
14685	      IF_DEBUG (debug_method_add (w, "B"));
14686	    }

Event const: After this line, the value of "last_text_row" is equal to 0
Event new_values: Conditional "last_text_row != 0"
Also see events: [dead_error_line][dead_error_condition][const][assignment][new_values][new_values][dead_error_condition][assignment][new_values][dead_error_condition][assignment][new_values][const]

14687	  else if (last_text_row)
14688	    {
14689	      /* We have displayed either to the end of the window or at the
14690		 end of the window, i.e. the last row with text is to be found
14691		 in the desired matrix.  */
14692	      w->window_end_pos
14693		= make_number (Z - MATRIX_ROW_END_CHARPOS (last_text_row));
14694	      w->window_end_bytepos
14695		= Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_text_row);
14696	      w->window_end_vpos
14697		= make_number (MATRIX_ROW_VPOS (last_text_row, desired_matrix));
14698	      xassert (w->window_end_bytepos >= 0);
14699	    }

Event dead_error_condition: On this path, the condition "first_unchanged_at_end_row == 0" could not be false
Event dead_error_condition: On this path, the condition "last_text_row == 0" could not be false
Event dead_error_condition: On this path, the condition "last_text_row_at_end == 0" could not be false
Also see events: [dead_error_line][const][assignment][new_values][new_values][dead_error_condition][assignment][const][new_values][dead_error_condition][assignment][new_values][const]

14700	  else if (first_unchanged_at_end_row == NULL
14701		   && last_text_row == NULL
14702		   && last_text_row_at_end == NULL)
14703	    {
14704	      /* Displayed to end of window, but no line containing text was
14705		 displayed.  Lines were deleted at the end of the window.  */
14706	      int first_vpos = WINDOW_WANTS_HEADER_LINE_P (w) ? 1 : 0;
14707	      int vpos = XFASTINT (w->window_end_vpos);
14708	      struct glyph_row *current_row = current_matrix->rows + vpos;
14709	      struct glyph_row *desired_row = desired_matrix->rows + vpos;
14710	
14711	      for (row = NULL;
14712		   row == NULL && vpos >= first_vpos;
14713		   --vpos, --current_row, --desired_row)
14714		{
14715		  if (desired_row->enabled_p)
14716		    {
14717		      if (desired_row->displays_text_p)
14718			row = desired_row;
14719		    }
14720		  else if (current_row->displays_text_p)
14721		    row  = current_row;
14722		}
14723	
14724	      xassert (row != NULL);
14725	      w->window_end_vpos = make_number (vpos + 1);
14726	      w->window_end_pos = make_number (Z - MATRIX_ROW_END_CHARPOS (row));
14727	      w->window_end_bytepos = Z_BYTE - MATRIX_ROW_END_BYTEPOS (row);
14728	      xassert (w->window_end_bytepos >= 0);
14729	      IF_DEBUG (debug_method_add (w, "C"));
14730	    }
14731	  else

Event dead_error_line: Cannot reach this line of code
Also see events: [dead_error_condition][const][assignment][new_values][new_values][dead_error_condition][assignment][const][new_values][dead_error_condition][assignment][new_values][const]

14732	    abort ();
14733	

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Problem report #6
  2006-04-10 18:46 Problem report #6 Dan Nicolaescu
@ 2006-04-21 16:09 ` Dan Nicolaescu
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Nicolaescu @ 2006-04-21 16:09 UTC (permalink / raw)


This does not appear in the latest run, so please ignore it.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-04-21 16:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-10 18:46 Problem report #6 Dan Nicolaescu
2006-04-21 16:09 ` Dan Nicolaescu

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).