[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 01/11] diagnostics: style: minor changes
From: |
Akim Demaille |
Subject: |
[PATCH 01/11] diagnostics: style: minor changes |
Date: |
Sat, 21 Sep 2019 11:59:54 +0200 |
* src/location.c (location_caret): Factor two branches of an if.
---
src/location.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/src/location.c b/src/location.c
index d2314a18..cfbd6a78 100644
--- a/src/location.c
+++ b/src/location.c
@@ -235,14 +235,12 @@ location_caret (location loc, const char *style, FILE
*out)
/* If the line we want to quote is seekable (the same line as the previous
location), just seek it. If it was a previous line, we lost track of it,
so return to the start of file. */
- if (caret_info.line <= loc.start.line)
- fseek (caret_info.source, caret_info.offset, SEEK_SET);
- else
+ if (loc.start.line < caret_info.line)
{
caret_info.line = 1;
caret_info.offset = 0;
- fseek (caret_info.source, caret_info.offset, SEEK_SET);
}
+ fseek (caret_info.source, caret_info.offset, SEEK_SET);
/* Advance to the line's position, keeping track of the offset. */
while (caret_info.line < loc.start.line)
--
2.23.0
- [PATCH 00/11] diagnostics: truncate quoted sources to fit the screen width, Akim Demaille, 2019/09/21
- [PATCH 01/11] diagnostics: style: minor changes,
Akim Demaille <=
- [PATCH 04/11] diagnostics: style: use a boundary to track the caret_info, Akim Demaille, 2019/09/21
- [PATCH 02/11] diagnostics: style: add caret_set_file, Akim Demaille, 2019/09/21
- [PATCH 07/11] diagnostics: truncate quoted sources to fit the screen, Akim Demaille, 2019/09/21
- [PATCH 03/11] diagnostics: extract boundary_compute from location_compute, Akim Demaille, 2019/09/21
- [PATCH 06/11] diagnostics: learn how to count column number with multibyte chars, Akim Demaille, 2019/09/21
- [PATCH 05/11] diagnostics: style: rename member for clariy, Akim Demaille, 2019/09/21
- [PATCH 09/11] diagnostics: also show truncation at the end of line with "...", Akim Demaille, 2019/09/21
- [PATCH 10/11] diagnostics: don't print ellipsis on the caret line, Akim Demaille, 2019/09/21
- [PATCH 11/11] diagnostics: get the screen width from the terminal, Akim Demaille, 2019/09/21
- [PATCH 08/11] diagnostics: check that quoted lines are truncated, Akim Demaille, 2019/09/21