comparison src/indent.c @ 16926:3baea3418dec

(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.
author Richard M. Stallman <rms@gnu.org>
date Fri, 24 Jan 1997 09:31:18 +0000
parents c6b901f809da
children ded89d7e1575
comparison
equal deleted inserted replaced
16925:2b35e4ccbb32 16926:3baea3418dec
1233 { 1233 {
1234 int opoint = PT; 1234 int opoint = PT;
1235 int col; 1235 int col;
1236 int width = window_internal_width (w) - 1; 1236 int width = window_internal_width (w) - 1;
1237 1237
1238 if (pos == BEGV || FETCH_CHAR (pos - 1) == '\n') 1238 if (pos == BEGV)
1239 return MINI_WINDOW_P (w) ? -minibuf_prompt_width : 0;
1240 if (FETCH_CHAR (pos - 1) == '\n')
1239 return 0; 1241 return 0;
1240 TEMP_SET_PT (pos); 1242 TEMP_SET_PT (pos);
1241 col = current_column (); 1243 col = current_column ();
1242 TEMP_SET_PT (opoint); 1244 TEMP_SET_PT (opoint);
1245 /* In the continuation of the first line in a minibuffer we must
1246 take the width of the prompt into account. */
1247 if (MINI_WINDOW_P (w) && col >= width - minibuf_prompt_width
1248 && find_next_newline_no_quit (pos, -1) == BEGV)
1249 return col - (col + minibuf_prompt_width) % width;
1243 return col - (col % width); 1250 return col - (col % width);
1244 } 1251 }
1245 1252
1246 1253
1247 /* Fvertical_motion and vmotion */ 1254 /* Fvertical_motion and vmotion */
1312 pos = *compute_motion (XFASTINT (prevline), 0, 1319 pos = *compute_motion (XFASTINT (prevline), 0,
1313 lmargin + (XFASTINT (prevline) == BEG 1320 lmargin + (XFASTINT (prevline) == BEG
1314 ? start_hpos : 0), 1321 ? start_hpos : 0),
1315 0, 1322 0,
1316 from, 1 << (BITS_PER_INT - 2), 0, 1323 from, 1 << (BITS_PER_INT - 2), 0,
1317 width, hscroll, 0, w); 1324 width, hscroll,
1325 /* This compensates for start_hpos
1326 so that a tab as first character
1327 still occupies 8 columns. */
1328 (XFASTINT (prevline) == BEG
1329 ? -start_hpos : 0),
1330 w);
1318 vpos -= pos.vpos; 1331 vpos -= pos.vpos;
1319 first = 0; 1332 first = 0;
1320 from = XFASTINT (prevline); 1333 from = XFASTINT (prevline);
1321 } 1334 }
1322 1335
1359 pos = *compute_motion (XFASTINT (prevline), 0, 1372 pos = *compute_motion (XFASTINT (prevline), 0,
1360 lmargin + (XFASTINT (prevline) == BEG 1373 lmargin + (XFASTINT (prevline) == BEG
1361 ? start_hpos : 0), 1374 ? start_hpos : 0),
1362 0, 1375 0,
1363 from, 1 << (BITS_PER_INT - 2), 0, 1376 from, 1 << (BITS_PER_INT - 2), 0,
1364 width, hscroll, 0, w); 1377 width, hscroll,
1378 (XFASTINT (prevline) == BEG ? -start_hpos : 0),
1379 w);
1365 did_motion = 1; 1380 did_motion = 1;
1366 } 1381 }
1367 else 1382 else
1368 { 1383 {
1369 pos.hpos = lmargin + (from == BEG ? start_hpos : 0); 1384 pos.hpos = lmargin + (from == BEG ? start_hpos : 0);
1370 pos.vpos = 0; 1385 pos.vpos = 0;
1371 did_motion = 0; 1386 did_motion = 0;
1372 } 1387 }
1373 return compute_motion (from, vpos, pos.hpos, did_motion, 1388 return compute_motion (from, vpos, pos.hpos, did_motion,
1374 ZV, vtarget, - (1 << (BITS_PER_INT - 2)), 1389 ZV, vtarget, - (1 << (BITS_PER_INT - 2)),
1375 width, hscroll, pos.vpos * width, w); 1390 width, hscroll,
1391 pos.vpos * width - (from == BEG ? start_hpos : 0),
1392 w);
1376 } 1393 }
1377 1394
1378 DEFUN ("vertical-motion", Fvertical_motion, Svertical_motion, 1, 2, 0, 1395 DEFUN ("vertical-motion", Fvertical_motion, Svertical_motion, 1, 2, 0,
1379 "Move point to start of the screen line LINES lines down.\n\ 1396 "Move point to start of the screen line LINES lines down.\n\
1380 If LINES is negative, this means moving up.\n\ 1397 If LINES is negative, this means moving up.\n\