summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1997-01-24 09:31:18 +0000
committerRichard M. Stallman <rms@gnu.org>1997-01-24 09:31:18 +0000
commit2dd4e608e13224c5e117cbdb76d3dd37a4854aa8 (patch)
treea21e6a5e2c4d45c9182b19180b72a3ca46831230 /src
parent90ed3ec5e7bec48666ccaab662b923eabcb77bd8 (diff)
downloademacs-2dd4e608e13224c5e117cbdb76d3dd37a4854aa8.tar.gz
(pos_tab_offset): Take the width of the minibuffer prompt into account.
(vmotion): In calls to compute_motion use a value for tab_offset that is corrected by the minibuffer prompt width.
Diffstat (limited to 'src')
-rw-r--r--src/indent.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/src/indent.c b/src/indent.c
index 3ada091d45f..9cdfb3cf046 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -1235,11 +1235,18 @@ pos_tab_offset (w, pos)
int col;
int width = window_internal_width (w) - 1;
- if (pos == BEGV || FETCH_CHAR (pos - 1) == '\n')
+ if (pos == BEGV)
+ return MINI_WINDOW_P (w) ? -minibuf_prompt_width : 0;
+ if (FETCH_CHAR (pos - 1) == '\n')
return 0;
TEMP_SET_PT (pos);
col = current_column ();
TEMP_SET_PT (opoint);
+ /* In the continuation of the first line in a minibuffer we must
+ take the width of the prompt into account. */
+ if (MINI_WINDOW_P (w) && col >= width - minibuf_prompt_width
+ && find_next_newline_no_quit (pos, -1) == BEGV)
+ return col - (col + minibuf_prompt_width) % width;
return col - (col % width);
}
@@ -1314,7 +1321,13 @@ vmotion (from, vtarget, w)
? start_hpos : 0),
0,
from, 1 << (BITS_PER_INT - 2), 0,
- width, hscroll, 0, w);
+ width, hscroll,
+ /* This compensates for start_hpos
+ so that a tab as first character
+ still occupies 8 columns. */
+ (XFASTINT (prevline) == BEG
+ ? -start_hpos : 0),
+ w);
vpos -= pos.vpos;
first = 0;
from = XFASTINT (prevline);
@@ -1361,7 +1374,9 @@ vmotion (from, vtarget, w)
? start_hpos : 0),
0,
from, 1 << (BITS_PER_INT - 2), 0,
- width, hscroll, 0, w);
+ width, hscroll,
+ (XFASTINT (prevline) == BEG ? -start_hpos : 0),
+ w);
did_motion = 1;
}
else
@@ -1372,7 +1387,9 @@ vmotion (from, vtarget, w)
}
return compute_motion (from, vpos, pos.hpos, did_motion,
ZV, vtarget, - (1 << (BITS_PER_INT - 2)),
- width, hscroll, pos.vpos * width, w);
+ width, hscroll,
+ pos.vpos * width - (from == BEG ? start_hpos : 0),
+ w);
}
DEFUN ("vertical-motion", Fvertical_motion, Svertical_motion, 1, 2, 0,