From: "Scott Flowers" <flowerss@cranky.ca>
To: 9front@9front.org
Subject: Re: [9front] Bug or inconsistency in cursor behaviour?
Date: Mon, 28 Oct 2024 17:04:46 -0600 [thread overview]
Message-ID: <ed9b944f-3142-4b40-b268-76cc102a674e@app.fastmail.com> (raw)
In-Reply-To: <d7318b5a-78f7-4315-8125-28b2f2eae9c6@app.fastmail.com>
Actually, ignore that recommendation to ignore that patch. I panicked. I chalk it up to first-patch-submission jitters. Below will make acme and rio left and right arrow keys move the cursor to the beginning and end of selected text respectively, instead of one extra character left or right.
diff 6894c4e13a24e9983e2daf4ee2566f8396d29f4e uncommitted
--- a/sys/src/cmd/rio/wind.c
+++ b/sys/src/cmd/rio/wind.c
@@ -892,16 +892,30 @@
return;
case Kleft:
if(w->q0 > 0){
- q0 = w->q0-1;
- wsetselect(w, q0, q0);
- wshow(w, q0);
+ if(w->q1 != w->q0) {
+ q0 = w->q0;
+ wsetselect(w, q0, q0);
+ wshow(w, q0);
+ }
+ else {
+ q0 = w->q0-1;
+ wsetselect(w, q0, q0);
+ wshow(w, q0);
+ }
}
return;
case Kright:
if(w->q1 < w->nr){
- q1 = w->q1+1;
- wsetselect(w, q1, q1);
- wshow(w, q1);
+ if(w->q1 != w->q0) {
+ q1 = w->q1;
+ wsetselect(w, q1, q1);
+ wshow(w, q1);
+ }
+ else {
+ q1 = w->q1+1;
+ wsetselect(w, q1, q1);
+ wshow(w, q1);
+ }
}
return;
case Khome:
diff 6894c4e13a24e9983e2daf4ee2566f8396d29f4e uncommitted
--- a/sys/src/cmd/acme/text.c
+++ b/sys/src/cmd/acme/text.c
@@ -680,13 +680,24 @@
switch(r){
case Kleft:
typecommit(t);
- if(t->q0 > 0)
- textshow(t, t->q0-1, t->q0-1, TRUE);
+ if(t->q0 > 0) {
+ if(t->q0 != t->q1) {
+ textshow(t, t->q0, t->q0, TRUE);
+ }
+ else {
+ textshow(t, t->q0-1, t->q0-1, TRUE);
+ }
+ }
return;
case Kright:
typecommit(t);
if(t->q1 < t->file->nc)
- textshow(t, t->q1+1, t->q1+1, TRUE);
+ if(t->q0 != t->q1) {
+ textshow(t, t->q1, t->q1, TRUE);
+ }
+ else {
+ textshow(t, t->q1+1, t->q1+1, TRUE);
+ }
return;
case Kdown:
n = t->maxlines/3;
Thanks,
Scott
next prev parent reply other threads:[~2024-10-28 23:06 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-28 20:19 flowerss
2024-10-28 22:49 ` Scott Flowers
2024-10-28 22:59 ` Scott Flowers
2024-10-28 23:04 ` Scott Flowers [this message]
2024-10-28 23:45 ` Thaddeus Woskowiak
2024-10-29 0:35 ` Scott Flowers
2024-10-29 9:59 ` hiro
2024-10-29 15:16 ` Scott Flowers
2024-10-29 17:40 ` hiro
2024-10-29 17:41 ` hiro
2024-10-29 1:40 ` ori
2024-10-29 3:31 ` Scott Flowers
2024-10-29 4:32 ` umbraticus
2024-10-29 9:26 ` hiro
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=ed9b944f-3142-4b40-b268-76cc102a674e@app.fastmail.com \
--to=flowerss@cranky.ca \
--cc=9front@9front.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).