git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Harmful LESS flags

From
Jeff King <peff@peff.net>
Date
Apr 24, 2014, 21:35 UTC
Message-ID
<20140424213529.GB7815@sigill.intra.peff.net>
In-Reply-To
<xmqq8uquv84u.fsf@gitster.dls.corp.google.com>
On Thu, Apr 24, 2014 at 12:29:21PM -0700, Junio C Hamano wrote:
Show 16 quoted lines
> David Kastrup <dak@gnu.org> writes:
> 
> > Junio C Hamano <gitster@pobox.com> writes:
> >
> >> Traditionally, because the tool grew in a context of being used in a
> >> project whose participants are at least not malicious, always having
> >> to be on the lookout for fear of middle-of-line tabs hiding bad
> >> contents near the right edges of lines has never been an issue.
> >
> > My beef is not with "hiding bad contents" but with "hiding contents".
> > It makes the output useless for seeing what is actually happening as
> > soon as the option starts having an effect.
> 
> My suspicion is that one of the reasons why S was chosen to be in
> the default was to mildly discourage people from busting the usual
> line-length limit, but I am not Linus ;-)

I would think it's the opposite. Long lines look _horrible_ without "-S", as they get wrapped at awkward points. Using "-S" means that long lines don't bug you, unless you really want to scroll over and see the content.

I really think the right solution here is to teach less to make it more obvious that there is something worth scrolling over to. Here's a very rough patch for less, if you want to see what I'm thinking of.

diff --git a/input.c b/input.c
index b211323..01aa411 100755
--- a/input.c
+++ b/input.c
@@ -178,6 +178,7 @@ get_forw_line:
 			 */
 			if (chopline || hshift > 0)
 			{
+				set_chopped_marker(ch_tell()-1);
 				do
 				{
 					if (ABORT_SIGS())
diff --git a/line.c b/line.c
index 1eb3914..b3358a0 100755
--- a/line.c
+++ b/line.c
@@ -1080,6 +1080,20 @@ set_status_col(c)
 	attr[0] = AT_NORMAL|AT_HILITE;
 }
 
+	public void
+set_chopped_marker(pos)
+	    POSITION pos;
+{
+	/*
+	 * Roll back output by one character; probably
+	 * we need to actually walk curr back further
+	 * for multibyte characters?
+	 */
+	column--;
+	curr--;
+	store_char('>', AT_NORMAL|AT_HILITE, NULL, pos);
+}
+
 /*
  * Get a character from the current line.
  * Return the character as the function return value,

-Peff
Previous: David KastrupNext: Junio C Hamano
Message 9 of 41 in “Harmful LESS flags”
  1. d9ba@mailtor.netApr 23, 2014
  2. Jonathan NiederApr 24, 2014
  3. Mark NudelmanApr 28, 2014
  4. David KastrupApr 24, 2014
  5. Junio C HamanoApr 24, 2014
  6. David KastrupApr 24, 2014
  7. Junio C HamanoApr 24, 2014
  8. David KastrupApr 24, 2014
  9. Jeff KingApr 24, 2014
  10. Junio C HamanoApr 24, 2014
  11. Jeff KingApr 24, 2014
  12. David KastrupApr 24, 2014
  13. Jeff KingApr 24, 2014
  14. David KastrupApr 24, 2014
  15. Jonathan NiederApr 24, 2014
  16. Matthieu MoyApr 25, 2014
  17. Jonathan NiederApr 25, 2014
  18. David KastrupApr 25, 2014
  19. Jonathan NiederApr 25, 2014
  20. PAGER_ENV: remove 'S' from $LESS by defaultMatthieu Moy, Apr 28, 2014
  21. David KastrupApr 28, 2014
  22. Matthieu MoyApr 28, 2014
  23. David KastrupApr 28, 2014
  24. Matthieu MoyApr 28, 2014
  25. Jeff KingApr 28, 2014
  26. Junio C HamanoApr 28, 2014
  27. Matthieu MoyApr 29, 2014
  28. Junio C HamanoApr 29, 2014
  29. pager: remove 'S' from $LESS by defaultMatthieu Moy, Apr 30, 2014
  30. Junio C HamanoApr 30, 2014
  31. Matthieu MoyApr 30, 2014
  32. Junio C HamanoApr 30, 2014
  33. Jonathan NiederMay 5, 2014
  34. Matthieu MoyMay 5, 2014
  35. Junio C HamanoMay 6, 2014
  36. David KastrupMay 6, 2014
  37. Matthieu MoyMay 6, 2014
  38. Jeff KingMay 6, 2014
  39. Junio C HamanoMay 7, 2014
  40. Matthieu MoyMay 7, 2014
  41. Junio C HamanoMay 7, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.