>> > 1. What's the purpose of the following in > build_frame_matrix_from_leaf_window? "frame_row->used[TEXT_AREA]" will > always end up being equal to "window_matrix->matrix_w" after processing > the right-most window of the row. I don't understand. What about the /matrix_x/ + matrix_w below? > > --8<---------------cut here---------------start------------->8--- > /* Set number of used glyphs in the frame matrix. Since we fill > up with spaces, and visit leaf windows from left to right it > can be done simply. */ > frame_row->used[TEXT_AREA] > = window_matrix->matrix_x + window_matrix->matrix_w; > --8<---------------cut here---------------end--------------->8--- > > > 2. From the documentation of make-terminal-frame: > > > Note that changing the size of one terminal frame automatically > > affects all frames on the same terminal device. > > > But why? Do they share glyph matrices, since only one of them is > visible at a single time? How else should other frames behave? Leave a "hole" on the terminal where nothing is displayed when the TTY window is made larger? And what if the terminal is made smaller? > > > 3. Why clear the desired matrix in build_frame_matrix? As I understand, > that would clear the glyph matrices of windows the frame, because window > desired matrix shares memory with frame desired matrix, and its seems > like build_frame_matrix is called after window desired matrices are > built. > > --8<---------------cut here---------------start------------->8--- > /* Clear all rows in the frame matrix covered by window matrices. > Menu bar lines are not covered by windows. */ > for (i = FRAME_TOP_MARGIN (f); i < f->desired_matrix->nrows; ++i) > clear_glyph_row (MATRIX_ROW (f->desired_matrix, i)); > --8<---------------cut here---------------end--------------->8--- In the TTY case, the glyph memory (struct glyph) for desired window matrices is sub-allocated from the glyph memory that is allocated for the frame. The glyph_row structures on the other hand are different between windows and frame. Clear_glyph_row doesn't affect the glyph memory, only the glyh_rows. > > > 4. And one more question: why don't Emacs is use the window feature of > ncurses despite depending on it? Is it inefficient or lack of any > feature? > The reasons I can think of are - ncurses is considerably younger than Emacs - Its predecessor 'curses' (from BSD, IIRC) wasn't available everywhere (think VMS, MS-DOS, maybe others), when that part of the code was written. I would guess that might have been around 1985. What would that be - Emacs 16 :-). Maybe there are also other technical reasons that make a rewrite with ncurses impossible, I don'T know. (And there's of course always the consideration of why rewrite something that works.)