HCoop
/
bpt
/
emacs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix image fg and bg colors on NS (Bug#9175).
[bpt/emacs.git]
/
src
/
indent.c
diff --git
a/src/indent.c
b/src/indent.c
index
0fdc45a
..
aaeaaf5
100644
(file)
--- a/
src/indent.c
+++ b/
src/indent.c
@@
-318,6
+318,15
@@
invalidate_current_column (void)
last_known_column_point = 0;
}
last_known_column_point = 0;
}
+/* Return a non-outlandish value for the tab width. */
+
+static int
+sane_tab_width (void)
+{
+ EMACS_INT n = XFASTINT (BVAR (current_buffer, tab_width));
+ return 0 < n && n <= 1000 ? n : 8;
+}
+
EMACS_INT
current_column (void)
{
EMACS_INT
current_column (void)
{
@@
-326,7
+335,7
@@
current_column (void)
register int tab_seen;
EMACS_INT post_tab;
register int c;
register int tab_seen;
EMACS_INT post_tab;
register int c;
-
register EMACS_INT tab_width = XINT (BVAR (current_buffer, tab_width)
);
+
int tab_width = sane_tab_width (
);
int ctl_arrow = !NILP (BVAR (current_buffer, ctl_arrow));
register struct Lisp_Char_Table *dp = buffer_display_table ();
int ctl_arrow = !NILP (BVAR (current_buffer, ctl_arrow));
register struct Lisp_Char_Table *dp = buffer_display_table ();
@@
-356,9
+365,6
@@
current_column (void)
else
stop = GAP_END_ADDR;
else
stop = GAP_END_ADDR;
- if (tab_width <= 0 || tab_width > 1000)
- tab_width = 8;
-
col = 0, tab_seen = 0, post_tab = 0;
while (1)
col = 0, tab_seen = 0, post_tab = 0;
while (1)
@@
-509,7
+515,7
@@
check_display_width (EMACS_INT pos, EMACS_INT col, EMACS_INT *endpos)
static void
scan_for_column (EMACS_INT *endpos, EMACS_INT *goalcol, EMACS_INT *prevcol)
{
static void
scan_for_column (EMACS_INT *endpos, EMACS_INT *goalcol, EMACS_INT *prevcol)
{
-
register EMACS_INT tab_width = XINT (BVAR (current_buffer, tab_width)
);
+
int tab_width = sane_tab_width (
);
register int ctl_arrow = !NILP (BVAR (current_buffer, ctl_arrow));
register struct Lisp_Char_Table *dp = buffer_display_table ();
int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters));
register int ctl_arrow = !NILP (BVAR (current_buffer, ctl_arrow));
register struct Lisp_Char_Table *dp = buffer_display_table ();
int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters));
@@
-535,7
+541,6
@@
scan_for_column (EMACS_INT *endpos, EMACS_INT *goalcol, EMACS_INT *prevcol)
window = Fget_buffer_window (Fcurrent_buffer (), Qnil);
w = ! NILP (window) ? XWINDOW (window) : NULL;
window = Fget_buffer_window (Fcurrent_buffer (), Qnil);
w = ! NILP (window) ? XWINDOW (window) : NULL;
- if (tab_width <= 0 || tab_width > 1000) tab_width = 8;
memset (&cmp_it, 0, sizeof cmp_it);
cmp_it.id = -1;
composition_compute_stop_pos (&cmp_it, scan, scan_byte, end, Qnil);
memset (&cmp_it, 0, sizeof cmp_it);
cmp_it.id = -1;
composition_compute_stop_pos (&cmp_it, scan, scan_byte, end, Qnil);
@@
-720,15
+725,14
@@
current_column_1 (void)
If END is nil, that stands for the end of STRING. */
static double
If END is nil, that stands for the end of STRING. */
static double
-string_display_width (string, beg, end)
- Lisp_Object string, beg, end;
+string_display_width (Lisp_Object string, Lisp_Object beg, Lisp_Object end)
{
register int col;
register unsigned char *ptr, *stop;
register int tab_seen;
int post_tab;
register int c;
{
register int col;
register unsigned char *ptr, *stop;
register int tab_seen;
int post_tab;
register int c;
-
register int tab_width = XINT (current_buffer->tab_width
);
+
int tab_width = sane_tab_width (
);
int ctl_arrow = !NILP (current_buffer->ctl_arrow);
register struct Lisp_Char_Table *dp = buffer_display_table ();
int b, e;
int ctl_arrow = !NILP (current_buffer->ctl_arrow);
register struct Lisp_Char_Table *dp = buffer_display_table ();
int b, e;
@@
-755,8
+759,6
@@
string_display_width (string, beg, end)
going backwards from point. */
stop = SDATA (string) + b;
going backwards from point. */
stop = SDATA (string) + b;
- if (tab_width <= 0 || tab_width > 1000) tab_width = 8;
-
col = 0, tab_seen = 0, post_tab = 0;
while (1)
col = 0, tab_seen = 0, post_tab = 0;
while (1)
@@
-806,7
+808,7
@@
The return value is COLUMN. */)
{
EMACS_INT mincol;
register EMACS_INT fromcol;
{
EMACS_INT mincol;
register EMACS_INT fromcol;
-
register EMACS_INT tab_width = XINT (BVAR (current_buffer, tab_width)
);
+
int tab_width = sane_tab_width (
);
CHECK_NUMBER (column);
if (NILP (minimum))
CHECK_NUMBER (column);
if (NILP (minimum))
@@
-820,8
+822,6
@@
The return value is COLUMN. */)
if (fromcol == mincol)
return make_number (mincol);
if (fromcol == mincol)
return make_number (mincol);
- if (tab_width <= 0 || tab_width > 1000) tab_width = 8;
-
if (indent_tabs_mode)
{
Lisp_Object n;
if (indent_tabs_mode)
{
Lisp_Object n;
@@
-867,15
+867,13
@@
static EMACS_INT
position_indentation (register int pos_byte)
{
register EMACS_INT column = 0;
position_indentation (register int pos_byte)
{
register EMACS_INT column = 0;
-
register EMACS_INT tab_width = XINT (BVAR (current_buffer, tab_width)
);
+
int tab_width = sane_tab_width (
);
register unsigned char *p;
register unsigned char *stop;
unsigned char *start;
EMACS_INT next_boundary_byte = pos_byte;
EMACS_INT ceiling = next_boundary_byte;
register unsigned char *p;
register unsigned char *stop;
unsigned char *start;
EMACS_INT next_boundary_byte = pos_byte;
EMACS_INT ceiling = next_boundary_byte;
- if (tab_width <= 0 || tab_width > 1000) tab_width = 8;
-
p = BYTE_POS_ADDR (pos_byte);
/* STOP records the value of P at which we will need
to think about the gap, or about invisible text,
p = BYTE_POS_ADDR (pos_byte);
/* STOP records the value of P at which we will need
to think about the gap, or about invisible text,
@@
-1102,8
+1100,8
@@
static struct position val_compute_motion;
WINDOW_HAS_VERTICAL_SCROLL_BAR (window)
and frame_cols = FRAME_COLS (XFRAME (window->frame))
WINDOW_HAS_VERTICAL_SCROLL_BAR (window)
and frame_cols = FRAME_COLS (XFRAME (window->frame))
- Or you can let window_bo
x_text
_cols do this all for you, and write:
- window_bo
x_text
_cols (w) - 1
+ Or you can let window_bo
dy
_cols do this all for you, and write:
+ window_bo
dy
_cols (w) - 1
The `-1' accounts for the continuation-line backslashes; the rest
accounts for window borders if the window is split horizontally, and
The `-1' accounts for the continuation-line backslashes; the rest
accounts for window borders if the window is split horizontally, and
@@
-1118,7
+1116,7
@@
compute_motion (EMACS_INT from, EMACS_INT fromvpos, EMACS_INT fromhpos, int did_
register EMACS_INT pos;
EMACS_INT pos_byte;
register int c = 0;
register EMACS_INT pos;
EMACS_INT pos_byte;
register int c = 0;
-
register EMACS_INT tab_width = XFASTINT (BVAR (current_buffer, tab_width)
);
+
int tab_width = sane_tab_width (
);
register int ctl_arrow = !NILP (BVAR (current_buffer, ctl_arrow));
register struct Lisp_Char_Table *dp = window_display_table (win);
EMACS_INT selective
register int ctl_arrow = !NILP (BVAR (current_buffer, ctl_arrow));
register struct Lisp_Char_Table *dp = window_display_table (win);
EMACS_INT selective
@@
-1173,13
+1171,10
@@
compute_motion (EMACS_INT from, EMACS_INT fromvpos, EMACS_INT fromhpos, int did_
run cache, because that's based on the buffer's display table. */
width_table = 0;
run cache, because that's based on the buffer's display table. */
width_table = 0;
- if (tab_width <= 0 || tab_width > 1000)
- tab_width = 8;
-
/* Negative width means use all available text columns. */
if (width < 0)
{
/* Negative width means use all available text columns. */
if (width < 0)
{
- width = window_bo
x_text
_cols (win);
+ width = window_bo
dy
_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)))
/* We must make room for continuation marks if we don't have fringes. */
#ifdef HAVE_WINDOW_SYSTEM
if (!FRAME_WINDOW_P (XFRAME (win->frame)))
@@
-1747,7
+1742,7
@@
visible section of the buffer, and pass LINE and COL as TOPOS. */)
struct window *w;
Lisp_Object bufpos, hpos, vpos, prevhpos;
struct position *pos;
struct window *w;
Lisp_Object bufpos, hpos, vpos, prevhpos;
struct position *pos;
-
int
hscroll, tab_offset;
+
EMACS_INT
hscroll, tab_offset;
CHECK_NUMBER_COERCE_MARKER (from);
CHECK_CONS (frompos);
CHECK_NUMBER_COERCE_MARKER (from);
CHECK_CONS (frompos);
@@
-1792,7
+1787,7
@@
visible section of the buffer, and pass LINE and COL as TOPOS. */)
? window_internal_height (w)
: XINT (XCDR (topos))),
(NILP (topos)
? window_internal_height (w)
: XINT (XCDR (topos))),
(NILP (topos)
- ? (window_bo
x_text
_cols (w)
+ ? (window_bo
dy
_cols (w)
- (
#ifdef HAVE_WINDOW_SYSTEM
FRAME_WINDOW_P (XFRAME (w->frame)) ? 0 :
- (
#ifdef HAVE_WINDOW_SYSTEM
FRAME_WINDOW_P (XFRAME (w->frame)) ? 0 :
@@
-1990,9
+1985,11
@@
whether or not it is currently displayed in some window. */)
struct text_pos pt;
struct window *w;
Lisp_Object old_buffer;
struct text_pos pt;
struct window *w;
Lisp_Object old_buffer;
- struct gcpro gcpro1;
+ EMACS_INT old_charpos IF_LINT (= 0), old_bytepos IF_LINT (= 0);
+ struct gcpro gcpro1, gcpro2, gcpro3;
Lisp_Object lcols = Qnil;
double cols IF_LINT (= 0);
Lisp_Object lcols = Qnil;
double cols IF_LINT (= 0);
+ void *itdata = NULL;
/* Allow LINES to be of the form (HPOS . VPOS) aka (COLUMNS . LINES). */
if (CONSP (lines) && (NUMBERP (XCAR (lines))))
/* Allow LINES to be of the form (HPOS . VPOS) aka (COLUMNS . LINES). */
if (CONSP (lines) && (NUMBERP (XCAR (lines))))
@@
-2010,12
+2007,16
@@
whether or not it is currently displayed in some window. */)
w = XWINDOW (window);
old_buffer = Qnil;
w = XWINDOW (window);
old_buffer = Qnil;
- GCPRO
1 (old_buffer
);
+ GCPRO
3 (old_buffer, old_charpos, old_bytepos
);
if (XBUFFER (w->buffer) != current_buffer)
{
/* Set the window's buffer temporarily to the current buffer. */
old_buffer = w->buffer;
if (XBUFFER (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);
XSETBUFFER (w->buffer, current_buffer);
+ set_marker_both
+ (w->pointm, w->buffer, BUF_PT (current_buffer), BUF_PT_BYTE (current_buffer));
}
if (noninteractive)
}
if (noninteractive)
@@
-2029,6
+2030,7
@@
whether or not it is currently displayed in some window. */)
EMACS_INT it_start;
int first_x, it_overshoot_expected IF_LINT (= 0);
EMACS_INT it_start;
int first_x, it_overshoot_expected IF_LINT (= 0);
+ itdata = bidi_shelve_cache ();
SET_TEXT_POS (pt, PT, PT_BYTE);
start_display (&it, w, pt);
first_x = it.first_visible_x;
SET_TEXT_POS (pt, PT, PT_BYTE);
start_display (&it, w, pt);
first_x = it.first_visible_x;
@@
-2133,10
+2135,14
@@
whether or not it is currently displayed in some window. */)
}
SET_PT_BOTH (IT_CHARPOS (it), IT_BYTEPOS (it));
}
SET_PT_BOTH (IT_CHARPOS (it), IT_BYTEPOS (it));
+ bidi_unshelve_cache (itdata);
}
if (BUFFERP (old_buffer))
}
if (BUFFERP (old_buffer))
- w->buffer = old_buffer;
+ {
+ w->buffer = old_buffer;
+ set_marker_both (w->pointm, w->buffer, old_charpos, old_bytepos);
+ }
RETURN_UNGCPRO (make_number (it.vpos));
}
RETURN_UNGCPRO (make_number (it.vpos));
}