/* Indentation functions.
- Copyright (C) 1985-1988, 1993-1995, 1998, 2000-2011
+ Copyright (C) 1985-1988, 1993-1995, 1998, 2000-2012
Free Software Foundation, Inc.
This file is part of GNU Emacs.
#include <setjmp.h>
#include "lisp.h"
-#include "buffer.h"
#include "character.h"
+#include "buffer.h"
#include "category.h"
#include "composite.h"
#include "indent.h"
the next property change */
prop = Fget_char_property (position, Qinvisible,
(!NILP (window)
- && EQ (XWINDOW (window)->buffer, buffer))
+ && EQ (WGET (XWINDOW (window), buffer), buffer))
? window : buffer);
inv_p = TEXT_PROP_MEANS_INVISIBLE (prop);
/* When counting columns (window == nil), don't skip over ellipsis text. */
return val >= column;
}
\f
-DEFUN ("move-to-column", Fmove_to_column, Smove_to_column, 1, 2, "p",
+DEFUN ("move-to-column", Fmove_to_column, Smove_to_column, 1, 2,
+ "NMove to column: ",
doc: /* Move point to column COLUMN in the current line.
Interactively, COLUMN is the value of prefix numeric argument.
The column of a character is calculated by adding together the widths
ptrdiff_t width_run_end = from;
ptrdiff_t width_run_width = 0;
Lisp_Object *width_table;
- Lisp_Object buffer;
/* The next buffer pos where we should consult the width run cache. */
ptrdiff_t next_width_run = from;
struct composition_it cmp_it;
- XSETBUFFER (buffer, current_buffer);
XSETWINDOW (window, win);
width_run_cache_on_off ();
width = window_body_cols (win);
/* We must make room for continuation marks if we don't have fringes. */
#ifdef HAVE_WINDOW_SYSTEM
- if (!FRAME_WINDOW_P (XFRAME (win->frame)))
+ if (!FRAME_WINDOW_P (XFRAME (WGET (win, frame))))
#endif
width -= 1;
}
continuation_glyph_width = 1;
#ifdef HAVE_WINDOW_SYSTEM
- if (FRAME_WINDOW_P (XFRAME (win->frame)))
+ if (FRAME_WINDOW_P (XFRAME (WGET (win, frame))))
continuation_glyph_width = 0; /* In the fringe. */
#endif
? (window_body_cols (w)
- (
#ifdef HAVE_WINDOW_SYSTEM
- FRAME_WINDOW_P (XFRAME (w->frame)) ? 0 :
+ FRAME_WINDOW_P (XFRAME (WGET (w, frame))) ? 0 :
#endif
1))
: XINT (XCAR (topos))),
struct position *
vmotion (register ptrdiff_t from, register EMACS_INT vtarget, struct window *w)
{
- ptrdiff_t hscroll = XINT (w->hscroll);
+ ptrdiff_t hscroll = w->hscroll;
struct position pos;
/* vpos is cumulative vertical position, changed as from is changed */
register EMACS_INT vpos = 0;
/* If the window contains this buffer, use it for getting text properties.
Otherwise use the current buffer as arg for doing that. */
- if (EQ (w->buffer, Fcurrent_buffer ()))
+ if (EQ (WGET (w, buffer), Fcurrent_buffer ()))
text_prop_object = window;
else
text_prop_object = Fcurrent_buffer ();
old_buffer = Qnil;
GCPRO3 (old_buffer, old_charpos, old_bytepos);
- if (XBUFFER (w->buffer) != current_buffer)
+ if (XBUFFER (WGET (w, buffer)) != current_buffer)
{
/* Set the window's buffer temporarily to the current buffer. */
- old_buffer = w->buffer;
- old_charpos = XMARKER (w->pointm)->charpos;
- old_bytepos = XMARKER (w->pointm)->bytepos;
- XSETBUFFER (w->buffer, current_buffer);
- set_marker_both
- (w->pointm, w->buffer, BUF_PT (current_buffer), BUF_PT_BYTE (current_buffer));
+ old_buffer = WGET (w, buffer);
+ old_charpos = XMARKER (WGET (w, pointm))->charpos;
+ old_bytepos = XMARKER (WGET (w, pointm))->bytepos;
+ WSET (w, buffer, Fcurrent_buffer ());
+ set_marker_both (WGET (w, pointm), WGET (w, buffer),
+ BUF_PT (current_buffer), BUF_PT_BYTE (current_buffer));
}
if (noninteractive)
ptrdiff_t it_start, it_overshoot_count = 0;
int first_x;
int overshoot_handled = 0;
+ int disp_string_at_start_p = 0;
itdata = bidi_shelve_cache ();
SET_TEXT_POS (pt, PT, PT_BYTE);
{
const char *s = SSDATA (it.string);
const char *e = s + SBYTES (it.string);
+
+ disp_string_at_start_p = it.string_from_display_prop_p;
while (s < e)
{
if (*s++ == '\n')
/* IT may move too far if truncate-lines is on and PT lies
beyond the right margin. IT may also move too far if the
starting point is on a Lisp string that has embedded
- newlines. In these cases, backtrack. */
+ newlines, or spans several screen lines. In these cases,
+ backtrack. */
if (IT_CHARPOS (it) > it_start)
{
/* We need to backtrack also if the Lisp string contains no
&& it.method == GET_FROM_BUFFER
&& it.c == '\n')
it_overshoot_count = 1;
+ else if (disp_string_at_start_p && it.vpos > 0)
+ {
+ /* This is the case of a display string that spans
+ several screen lines. In that case, we end up at the
+ end of the string, and it.vpos tells us how many
+ screen lines we need to backtrack. */
+ it_overshoot_count = it.vpos;
+ }
if (it_overshoot_count > 0)
move_it_by_lines (&it, -it_overshoot_count);
}
move_it_in_display_line
(&it, ZV,
- (int)(cols * FRAME_COLUMN_WIDTH (XFRAME (w->frame)) + 0.5),
+ (int)(cols * FRAME_COLUMN_WIDTH (XFRAME (WGET (w, frame))) + 0.5),
MOVE_TO_X);
}
if (BUFFERP (old_buffer))
{
- w->buffer = old_buffer;
- set_marker_both (w->pointm, w->buffer, old_charpos, old_bytepos);
+ WSET (w, buffer, old_buffer);
+ set_marker_both (WGET (w, pointm), WGET (w, buffer),
+ old_charpos, old_bytepos);
}
RETURN_UNGCPRO (make_number (it.vpos));
syms_of_indent (void)
{
DEFVAR_BOOL ("indent-tabs-mode", indent_tabs_mode,
- doc: /* *Indentation can insert tabs if this is non-nil. */);
+ doc: /* Indentation can insert tabs if this is non-nil. */);
indent_tabs_mode = 1;
defsubr (&Scurrent_indentation);