From: cworth@cworth.org (Carl Worth)
Subject: [sup-talk] [PATCH] Be less overzealous in moving text to the left column
Date: Wed, 19 Aug 2009 23:31:25 -0700 [thread overview]
Message-ID: <1250749447-sup-1744@yoom.home.cworth.org> (raw)
Specifically, scroll as little as possible to get the current message
to just fit on the right side.
---
This seems to work quite nicely and I think is ready to be comitted as
is. It's still not perfect in a few ways though, which I think we can
leave for subsequent commits:
1. I *think* that with this change the loose_alignment mode is
unnecessary. But I confess that I didn't totally understand the
calculation it is making, so I tried to just preserve its behavior
rather than ripping it out.
2. In deep threads of short messages, (so that lots of nesting is
visible in one screenful), it's easier than it was before for
messages other than the current message to be scrolled off to the
right, (though the current message is always made to fit if
possible). I can imagine someone finding the current patch
unacceptable based on this.
The fix for this would be to consider the total width of all
visible messages when making the calculation made here, rather than
just the width of the current message. I'm not sure how readily
available that number is.
3. It's still easy to get stuff scrolled off to the left, (which was a
symptom of the original bug I'm trying to fix), when doing
something like (E: Expand all messages). This command should
recompute a left column, so perhaps we should abstract the
left-column calculation out to some shared place.
Anyway, all feedback is quite welcome,
-Carl (happy to finally be running code from git and contributing patches)
lib/sup/modes/thread-view-mode.rb | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/lib/sup/modes/thread-view-mode.rb b/lib/sup/modes/thread-view-mode.rb
index dfe30ff..678b841 100644
--- a/lib/sup/modes/thread-view-mode.rb
+++ b/lib/sup/modes/thread-view-mode.rb
@@ -423,6 +423,9 @@ EOS
0
end
+ ## scroll as little as possible to make the message fit
+ ideal_left = (-(buffer.content_width - l.width - left - 1)).clamp(0, ideal_left)
+
jump_to_col [ideal_left, 0].max
## either way, move the cursor to the first line
--
1.6.3.3
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://rubyforge.org/pipermail/sup-talk/attachments/20090819/16ea9c2d/attachment.bin>
next reply other threads:[~2009-08-20 6:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-20 6:31 Carl Worth [this message]
2009-08-23 17:55 ` William Morgan
2009-08-26 21:53 ` Carl Worth
2009-09-03 17:12 ` William Morgan
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=1250749447-sup-1744@yoom.home.cworth.org \
--to=cworth@cworth.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