diff --git a/src/dispnew.c b/src/dispnew.c index ccb08ec1b9..068296212f 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -3497,6 +3497,40 @@ update_window (struct window *w, bool force_p) set_cursor: + +/* *************************************************************************** */ +/* MULTIPLE-CURSORS */ + + for (struct glyph_row *desired_row = MATRIX_ROW (desired_matrix, 0); + desired_row < end + && (force_p || !input_pending) + && BUFFERP (w->contents) + && (!NILP (BVAR (XBUFFER (w->contents), crosshairs))); + ++desired_row) + { + if (desired_row->enabled_p) + continue; + wset_mc_temp_cache (w, Qnil); + int vpos = MATRIX_ROW_VPOS (desired_row, desired_matrix); + struct glyph_matrix *current_matrix = w->current_matrix; + struct glyph_row *current_row = MATRIX_ROW (current_matrix, vpos); + if (current_row->enabled_p) + { + Lisp_Object head = w->mc_temp_cache; + // Replace each element with the Lisp integer position + for (int i = 0; CONSP (head); ++i, head = XCDR (head)) + XSETCAR (head, make_fixnum (i)); + } + } + + Lisp_Object head = w->ch_cache; + // Replace each element with the Lisp integer position + for (int i = 0; CONSP (head); ++i, head = XCDR (head)) + XSETCAR (head, make_fixnum (i)); + +/* *************************************************************************** */ + + /* Update the header line after scrolling because a new header line would otherwise overwrite lines at the top of the window that can be scrolled. */ diff --git a/src/window.c b/src/window.c index ef2ed63850..6ee1f65d9f 100644 --- a/src/window.c +++ b/src/window.c @@ -4252,6 +4252,9 @@ make_window (void) w->scroll_bar_width = -1; w->scroll_bar_height = -1; w->column_number_displayed = -1; + /* Your MC caches -- note there's only 2 lists ever created for them */ + w->ch_cache = Fmake_list (make_fixnum (100), Qnil); + w->mc_temp_cache = Fmake_list (make_fixnum (100), Qnil); /* Reset window_list. */ Vwindow_list = Qnil; /* Return window. */