<feed xmlns='http://www.w3.org/2005/Atom'>
<title>plan9port/plumb, branch patch</title>
<subtitle>Plan 9 from User Space (with patches)</subtitle>
<link rel='alternate' type='text/html' href='https://git.rctt.net/plan9port/'/>
<entry>
<title>plumb/basic: avoid wrap around in file:1:2 (#158)</title>
<updated>2018-11-14T04:59:04+00:00</updated>
<author>
<name>Martin Kühl</name>
<email>martin.kuehl@gmail.com</email>
</author>
<published>2018-11-14T04:59:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rctt.net/plan9port/commit/?id=73ea36569e83560168cfd7e40d85d9d247bce593'/>
<id>73ea36569e83560168cfd7e40d85d9d247bce593</id>
<content type='text'>
Fixes #122, #140.

As reported in #122, `file:1:1` moves to the end of the file,
and `file:1:2` fails with “address out of range”.

I’ll use file:2:3 as an example so we can tell the line and column number apart.

What’s happening is this:
plumb/basic matches `2:3` using twocolonaddr (from plumb/fileaddr),
then sets addr to `2-#1+#3`
(the 1 is constant and was introduced because column numbers are 1-based).
Acme interprets this in three steps:

1. find the range (q0, q1) that contains line 2
2. create the range (q2, q2) where q2 = q0 - 1
3. create the range (q3, q3) where q3 = q2 + 3

The second step has a branch where if q0 == 0 and 1 &gt; 0
(remember that 1 is constant and comes form plumb/basic),
q0 is set to the end of the file.
This makes addressing things at the end of the file easier.

The problem then is that if we select line 1,
which starts at the beginning of the file,
q0 is always 0 and the branch in step 2) will always be used.
`1:1` is interpreted as `1-#1+#1` which starts at 0, wraps around to the end of the file, then moves 1 character backwards and then forwards again, ending at the end of the file.
`1:2` is interpretes as `1-#1+#2` which starts at 0, wraps around to the end od the file, then moves 1 character backwards and tries moving 2 characters forwards beyond the end of the file, resulting in the out of range error.

In #140 @rsc proposed transforming `:X:Y` into `:X-#0+#Y-#1` instead since that
avoids wrapping around by not moving backwards at first.
This change modifies `plumb/basic` to do that.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fixes #122, #140.

As reported in #122, `file:1:1` moves to the end of the file,
and `file:1:2` fails with “address out of range”.

I’ll use file:2:3 as an example so we can tell the line and column number apart.

What’s happening is this:
plumb/basic matches `2:3` using twocolonaddr (from plumb/fileaddr),
then sets addr to `2-#1+#3`
(the 1 is constant and was introduced because column numbers are 1-based).
Acme interprets this in three steps:

1. find the range (q0, q1) that contains line 2
2. create the range (q2, q2) where q2 = q0 - 1
3. create the range (q3, q3) where q3 = q2 + 3

The second step has a branch where if q0 == 0 and 1 &gt; 0
(remember that 1 is constant and comes form plumb/basic),
q0 is set to the end of the file.
This makes addressing things at the end of the file easier.

The problem then is that if we select line 1,
which starts at the beginning of the file,
q0 is always 0 and the branch in step 2) will always be used.
`1:1` is interpreted as `1-#1+#1` which starts at 0, wraps around to the end of the file, then moves 1 character backwards and then forwards again, ending at the end of the file.
`1:2` is interpretes as `1-#1+#2` which starts at 0, wraps around to the end od the file, then moves 1 character backwards and tries moving 2 characters forwards beyond the end of the file, resulting in the out of range error.

In #140 @rsc proposed transforming `:X:Y` into `:X-#0+#Y-#1` instead since that
avoids wrapping around by not moving backwards at first.
This change modifies `plumb/basic` to do that.</pre>
</div>
</content>
</entry>
<entry>
<title>plumb: allow @ in file names</title>
<updated>2018-11-12T16:09:39+00:00</updated>
<author>
<name>Russ Cox</name>
<email>rsc@swtch.com</email>
</author>
<published>2018-11-12T16:07:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rctt.net/plan9port/commit/?id=82abcd6fd693549b225e53c6c161ea3909f2cf00'/>
<id>82abcd6fd693549b225e53c6c161ea3909f2cf00</id>
<content type='text'>
Helps Go module download cache, Upspin, maybe others.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Helps Go module download cache, Upspin, maybe others.
</pre>
</div>
</content>
</entry>
<entry>
<title>acme: scroll a directory window when navigating if:</title>
<updated>2013-10-22T23:47:48+00:00</updated>
<author>
<name>Rob Pike</name>
<email>robpike@gmail.com</email>
</author>
<published>2013-10-22T23:47:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rctt.net/plan9port/commit/?id=5a69e405fcae96b476cdd7a0767e87b94c0b7266'/>
<id>5a69e405fcae96b476cdd7a0767e87b94c0b7266</id>
<content type='text'>
        - the cursor is on the last line
        - the navigation would put the cursor over the tag of the following text

R=rsc
CC=smckean83
https://codereview.appspot.com/15280045
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
        - the cursor is on the last line
        - the navigation would put the cursor over the tag of the following text

R=rsc
CC=smckean83
https://codereview.appspot.com/15280045
</pre>
</div>
</content>
</entry>
<entry>
<title>plumb: character offsets start at 1, not 0</title>
<updated>2011-08-31T13:22:22+00:00</updated>
<author>
<name>Russ Cox</name>
<email>rsc@swtch.com</email>
</author>
<published>2011-08-31T13:22:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rctt.net/plan9port/commit/?id=f0a4e8bd6cfb318e374e57f34b5676c6890fb1a2'/>
<id>f0a4e8bd6cfb318e374e57f34b5676c6890fb1a2</id>
<content type='text'>
x:10:1 is the beginning of line 10

R=rsc
http://codereview.appspot.com/4960049
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
x:10:1 is the beginning of line 10

R=rsc
http://codereview.appspot.com/4960049
</pre>
</div>
</content>
</entry>
<entry>
<title>plumb: column numbers in file address</title>
<updated>2010-10-28T00:31:18+00:00</updated>
<author>
<name>Russ Cox</name>
<email>rsc@swtch.com</email>
</author>
<published>2010-10-28T00:31:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rctt.net/plan9port/commit/?id=c84e737c3f64030dc9b66ddb931cac757e9ba986'/>
<id>c84e737c3f64030dc9b66ddb931cac757e9ba986</id>
<content type='text'>
R=rsc
http://codereview.appspot.com/2776042
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
R=rsc
http://codereview.appspot.com/2776042
</pre>
</div>
</content>
</entry>
<entry>
<title>plumb: change inferno module path to /usr/inferno/module (Anthony Sorace)</title>
<updated>2009-05-17T17:54:56+00:00</updated>
<author>
<name>Russ Cox</name>
<email>rsc@swtch.com</email>
</author>
<published>2009-05-17T17:54:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rctt.net/plan9port/commit/?id=9a0e0048423b0afe1da390354eca315d06ef165b'/>
<id>9a0e0048423b0afe1da390354eca315d06ef165b</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>plumbing: move email rule below file rules (Bengt Kleberg)</title>
<updated>2008-04-17T11:56:34+00:00</updated>
<author>
<name>Russ Cox</name>
<email>rsc@swtch.com</email>
</author>
<published>2008-04-17T11:56:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rctt.net/plan9port/commit/?id=64851eee5f6ba5fc9441074b9a11b9baaf064a90'/>
<id>64851eee5f6ba5fc9441074b9a11b9baaf064a90</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>plumb all urls, not just images (TheWhiteTiger)</title>
<updated>2007-04-03T12:49:27+00:00</updated>
<author>
<name>rsc</name>
<email>devnull@localhost</email>
</author>
<published>2007-04-03T12:49:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rctt.net/plan9port/commit/?id=41deef57ef8abbb64265cba6445f6bff5c99b455'/>
<id>41deef57ef8abbb64265cba6445f6bff5c99b455</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>allow _ - / in header file names</title>
<updated>2006-07-05T17:12:57+00:00</updated>
<author>
<name>rsc</name>
<email>devnull@localhost</email>
</author>
<published>2006-07-05T17:12:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rctt.net/plan9port/commit/?id=e50b313e64aedca5b2640b92d31bdf9bfccd4b53'/>
<id>e50b313e64aedca5b2640b92d31bdf9bfccd4b53</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>use 9 page instead of page</title>
<updated>2006-06-06T13:58:19+00:00</updated>
<author>
<name>rsc</name>
<email>devnull@localhost</email>
</author>
<published>2006-06-06T13:58:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rctt.net/plan9port/commit/?id=8b0728d3b5fa9afb4e7a4b83f2fb39052b291e4e'/>
<id>8b0728d3b5fa9afb4e7a4b83f2fb39052b291e4e</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
</feed>
