return decode_any_window (window)->prev;
}
-DEFUN ("window-combination-limit", Fwindow_combination_limit, Swindow_combination_limit, 0, 1, 0,
+DEFUN ("window-combination-limit", Fwindow_combination_limit, Swindow_combination_limit, 1, 1, 0,
doc: /* Return combination limit of window WINDOW.
-If WINDOW is omitted or nil, it defaults to the selected window.
-
If the return value is nil, child windows of WINDOW can be recombined with
WINDOW's siblings. A return value of t means that child windows of
WINDOW are never \(re-)combined with WINDOW's siblings. */)
}
DEFUN ("set-window-combination-limit", Fset_window_combination_limit, Sset_window_combination_limit, 2, 2, 0,
- doc: /* Set combination limit of window WINDOW to STATUS; return STATUS.
-If WINDOW is omitted or nil, it defaults to the selected window.
-
-If STATUS is nil, child windows of WINDOW can be recombined with
-WINDOW's siblings. STATUS t means that child windows of WINDOW are
+ doc: /* Set combination limit of window WINDOW to LIMIT; return LIMIT.
+If LIMIT is nil, child windows of WINDOW can be recombined with
+WINDOW's siblings. LIMIT t means that child windows of WINDOW are
never \(re-)combined with WINDOW's siblings. Other values are reserved
for future use. */)
- (Lisp_Object window, Lisp_Object status)
+ (Lisp_Object window, Lisp_Object limit)
{
register struct window *w = decode_any_window (window);
- w->combination_limit = status;
+ w->combination_limit = limit;
return w->combination_limit;
}
DEFUN ("coordinates-in-window-p", Fcoordinates_in_window_p,
Scoordinates_in_window_p, 2, 2, 0,
doc: /* Return non-nil if COORDINATES are in WINDOW.
+WINDOW must be a live window.
COORDINATES is a cons of the form (X . Y), X and Y being distances
measured in characters from the upper-left corner of the frame.
\(0 . 0) denotes the character in the upper left corner of the
int x, y;
Lisp_Object lx, ly;
- CHECK_WINDOW (window);
+ CHECK_LIVE_WINDOW (window);
w = XWINDOW (window);
f = XFRAME (w->frame);
CHECK_CONS (coordinates);
DEFUN ("next-window", Fnext_window, Snext_window, 0, 3, 0,
- doc: /* Return window following WINDOW in cyclic ordering of windows.
+ doc: /* Return live window after WINDOW in the cyclic ordering of windows.
WINDOW must be a live window and defaults to the selected one. The
optional arguments MINIBUF and ALL-FRAMES specify the set of windows to
consider.
DEFUN ("previous-window", Fprevious_window, Sprevious_window, 0, 3, 0,
- doc: /* Return window preceding WINDOW in cyclic ordering of windows.
+ doc: /* Return live window before WINDOW in the cyclic ordering of windows.
WINDOW must be a live window and defaults to the selected one. The
optional arguments MINIBUF and ALL-FRAMES specify the set of windows to
consider.
error ("Window is dedicated to `%s'", SDATA (BVAR (XBUFFER (tem), name)));
else
/* WINDOW is weakly dedicated to its buffer, reset
- dedicatedness. */
+ dedication. */
w->dedicated = Qnil;
call1 (Qrecord_window_buffer, window);
/* Return a pointer to the glyph W's physical cursor is on. Value is
- null if W's current matrix is invalid, so that no meaningfull glyph
+ null if W's current matrix is invalid, so that no meaningful glyph
can be returned. */
struct glyph *
get_phys_cursor_glyph (struct window *w)
{
struct glyph_row *row;
struct glyph *glyph;
+ int hpos = w->phys_cursor.hpos;
+
+ if (!(w->phys_cursor.vpos >= 0
+ && w->phys_cursor.vpos < w->current_matrix->nrows))
+ return NULL;
+
+ row = MATRIX_ROW (w->current_matrix, w->phys_cursor.vpos);
+ if (!row->enabled_p)
+ return NULL;
+
+ if (XINT (w->hscroll))
+ {
+ /* When the window is hscrolled, cursor hpos can legitimately be
+ out of bounds, but we draw the cursor at the corresponding
+ window margin in that case. */
+ if (!row->reversed_p && hpos < 0)
+ hpos = 0;
+ if (row->reversed_p && hpos >= row->used[TEXT_AREA])
+ hpos = row->used[TEXT_AREA] - 1;
+ }
- if (w->phys_cursor.vpos >= 0
- && w->phys_cursor.vpos < w->current_matrix->nrows
- && (row = MATRIX_ROW (w->current_matrix, w->phys_cursor.vpos),
- row->enabled_p)
- && row->used[TEXT_AREA] > w->phys_cursor.hpos)
- glyph = row->glyphs[TEXT_AREA] + w->phys_cursor.hpos;
+ if (row->used[TEXT_AREA] > hpos
+ && 0 <= hpos)
+ glyph = row->glyphs[TEXT_AREA] + hpos;
else
glyph = NULL;
ignore_positions non-zero means ignore non-matching scroll positions
and the like.
- This ignores a couple of things like the dedicatedness status of
+ This ignores a couple of things like the dedication status of
window, combination_limit and the like. This might have to be
fixed. */
Other values are reserved for future use.
-The value of this variable is also assigned to the combination-limit
-status of the new parent window. The combination-limit status of a
-window can be retrieved via the function `window-combination-limit' and
-altered by the function `set-window-combination-limit'. */);
+The value of this variable is also assigned to the combination limit of
+the new parent window. The combination limit of a window can be
+retrieved via the function `window-combination-limit' and altered by the
+function `set-window-combination-limit'. */);
Vwindow_combination_limit = Qnil;
defsubr (&Sselected_window);