GNU Binutils with patches for OS216
リビジョン | c74251adf3de3f0b248802a0aeb832f4e2471f1a (tree) |
---|---|
日時 | 2020-07-01 06:10:46 |
作者 | Chet Ramey <chet.ramey@case...> |
コミッター | Tom Tromey |
reading history entries with timestamps can result in joined entries
@@ -369,9 +369,11 @@ read_history_range (const char *filename, int from, int to) | ||
369 | 369 | } |
370 | 370 | |
371 | 371 | has_timestamps = HIST_TIMESTAMP_START (buffer); |
372 | - history_multiline_entries += has_timestamps && history_write_timestamps; | |
372 | + history_multiline_entries += has_timestamps && history_write_timestamps; | |
373 | 373 | |
374 | 374 | /* Skip lines until we are at FROM. */ |
375 | + if (has_timestamps) | |
376 | + last_ts = buffer; | |
375 | 377 | for (line_start = line_end = buffer; line_end < bufend && current_line < from; line_end++) |
376 | 378 | if (*line_end == '\n') |
377 | 379 | { |
@@ -380,7 +382,18 @@ read_history_range (const char *filename, int from, int to) | ||
380 | 382 | line. We should check more extensively here... */ |
381 | 383 | if (HIST_TIMESTAMP_START(p) == 0) |
382 | 384 | current_line++; |
385 | + else | |
386 | + last_ts = p; | |
383 | 387 | line_start = p; |
388 | + /* If we are at the last line (current_line == from) but we have | |
389 | + timestamps (has_timestamps), then line_start points to the | |
390 | + text of the last command, and we need to skip to its end. */ | |
391 | + if (current_line >= from && has_timestamps) | |
392 | + { | |
393 | + for (line_end = p; line_end < bufend && *line_end != '\n'; line_end++) | |
394 | + ; | |
395 | + line_start = (*line_end == '\n') ? line_end + 1 : line_end; | |
396 | + } | |
384 | 397 | } |
385 | 398 | |
386 | 399 | /* If there are lines left to gobble, then gobble them now. */ |
@@ -1,3 +1,3 @@ | ||
1 | 1 | # Do not edit -- exists only for use by patch |
2 | 2 | |
3 | -2 | |
3 | +3 |