From: Frank Rowand <frowand.list-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Julia Lawall <julia.lawall-L2FTfq7BK8M@public.gmane.org>,
devicetree-compiler-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH] srcpos: correct column numbers
Date: Mon, 15 Jan 2018 16:20:05 -0800 [thread overview]
Message-ID: <4eec9dbb-c047-86ae-e4b2-08de9f0499fe@gmail.com> (raw)
In-Reply-To: <alpine.DEB.2.20.1801151932100.25462@hadrien>
On 01/15/18 10:33, Julia Lawall wrote:
> The start of a line is column 0, at least according to emacs.
According to vim, the first character of a line is column 1. I don't know
if it has a concept of column 0, to the left of that character.
$ vim --version
VIM - Vi IMproved 7.4
Let the editor wars begin.... :-)
Personally, I use vim, but if the dtc column numbers match emac's world view
instead of vim's, that is fine with me.
-Frank
>
> Every character counts, so need to increment by 1 before adjusting for tab.
>
> Signed-off-by: Julia Lawall <Julia.Lawall-L2FTfq7BK8M@public.gmane.org>
> ---
> srcpos.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/srcpos.c b/srcpos.c
> index 9d38459..e8fced9 100644
> --- a/srcpos.c
> +++ b/srcpos.c
> @@ -154,7 +154,7 @@ void srcfile_push(const char *fname)
> srcfile->prev = current_srcfile;
>
> srcfile->lineno = 1;
> - srcfile->colno = 1;
> + srcfile->colno = 0;
>
> current_srcfile = srcfile;
> }
> @@ -223,8 +223,9 @@ void srcpos_update(struct srcpos *pos, const char *text, int len)
> for (i = 0; i < len; i++)
> if (text[i] == '\n') {
> current_srcfile->lineno++;
> - current_srcfile->colno = 1;
> + current_srcfile->colno = 0;
> } else if (text[i] == '\t') {
> + current_srcfile->colno++;
> current_srcfile->colno =
> ALIGN(current_srcfile->colno, TAB_SIZE);
> } else {
>
next prev parent reply other threads:[~2018-01-16 0:20 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-15 18:33 [PATCH] srcpos: correct column numbers Julia Lawall
2018-01-16 0:20 ` Frank Rowand [this message]
[not found] ` <4eec9dbb-c047-86ae-e4b2-08de9f0499fe-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-01-16 6:10 ` Julia Lawall
2018-01-18 4:22 ` David Gibson
[not found] ` <20180118042202.GI30352-K0bRW+63XPQe6aEkudXLsA@public.gmane.org>
2018-01-18 5:15 ` Julia Lawall
2018-01-18 7:01 ` David Gibson
[not found] ` <20180118070123.GV30352-K0bRW+63XPQe6aEkudXLsA@public.gmane.org>
2018-01-18 10:12 ` Julia Lawall
2018-01-19 5:44 ` David Gibson
[not found] ` <20180119054454.GA28299-K0bRW+63XPQe6aEkudXLsA@public.gmane.org>
2018-01-19 5:59 ` Julia Lawall
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4eec9dbb-c047-86ae-e4b2-08de9f0499fe@gmail.com \
--to=frowand.list-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=devicetree-compiler-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=julia.lawall-L2FTfq7BK8M@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).