From: Mathieu Lonjaret <mathieu.lonjaret@gmail.com>
To: golang-nuts <golang-nuts@googlegroups.com>,
Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: [9fans] get the last write offset in p9p acme
Date: Wed, 24 Aug 2011 18:45:58 +0200 [thread overview]
Message-ID: <CAHcDtnmaPxazZxQdhqzt8DxvX93nB2aTi9iU5TXdNpNBy130+w@mail.gmail.com> (raw)
Hi,
After I've written a bunch of lines in an acme win ( with (w *Win)
Write("body",...), I need to know (and save) the position of the last
char I've written.
I need that position because I want everything I write afterwards to
be written there, and not appended. (constantly overwriting the last
thing that was written).
So the silly trick I've used to get that position is to first select
the whole text and then get the address of the end of the selection,
as the following:
err = w.Addr("%s", "#0,")
if err != nil {
return err
}
_, pos, err := w.ReadAddr()
Is there a more direct way?
Thanks,
Mathieu
next reply other threads:[~2011-08-24 16:45 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-24 16:45 Mathieu Lonjaret [this message]
2011-08-24 17:03 ` Russ Cox
2011-08-25 8:35 ` Mathieu Lonjaret
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=CAHcDtnmaPxazZxQdhqzt8DxvX93nB2aTi9iU5TXdNpNBy130+w@mail.gmail.com \
--to=mathieu.lonjaret@gmail.com \
--cc=9fans@9fans.net \
--cc=golang-nuts@googlegroups.com \
/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).