bugGNU source-highlight - Bugs: bug #51089, Piping to source-highlight causes...

 
 

bug #51089: Piping to source-highlight causes less to always open full-screen

Submitter:  None
Submitted:  Tue 23 May 2017 12:10:53 AM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Sun 02 Jun 2019 02:26:53 PM UTC, comment #2: 

I think this was answered, so I'm closing it.

Tom Tromey <tromey>
Group administrator
Fri 05 Apr 2019 12:00:12 AM UTC, comment #1: 

This is caused by the explicit setting of LESS which overrides git's default of "FRX" if unset (read core.pager section of man git-config).

Inspecting the OPTIONS section of man less reveals that the "-F" option ("--quit-if-one-screen") is the one that makes less bail out if there is nothing to page and the "-X" ("--no-init") the one that prevents screen clearing ("-R" enables ANSI color code interpretation).

You could either set these globally for less for your user or to prevent interference with default behaviour like with git diff/log you could make a specific alias for syntax highlighted less using something like;

alias lesssh="LESSOPEN='|/usr/share/source-highlight/src-hilite-lesspipe.sh %s' LESS=R less"

Mikkel Kirkgaard Nielsen <mikini>
Tue 23 May 2017 12:10:53 AM UTC, original submission:  

I'm using homebrew's version of source-highlight (3.1.8, library 4:1:0), and I added the following lines to my ~/.bashrc

export LESSOPEN="| src-hilite-lesspipe.sh %s"
export LESS=" -R "

This successfully adds colors to less, but it also causes less to always open in full screen.  This is inconvenient for things like small git diff outputs (see attached screenshots.  This problem seems to be mac-specific.

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #40763:  Screen Shot 2017-05-22 at 5.02.06 PM.png added by None (39KiB - image/png - Screenshots of bad git diff)
file #40764:  Screen Shot 2017-05-22 at 5.02.26 PM.png added by None (52KiB - image/png - Screenshots of bad git diff)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by tromey (Posted a comment)
  • -email is unavailable- added by mikini (Posted a comment)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-06-02 tromey Open/ClosedOpen Closed
    2017-05-23 None Attached File- Added Screen Shot 2017-05-22 at 5.02.06 PM.png, #40763
        Attached File- Added Screen Shot 2017-05-22 at 5.02.26 PM.png, #40764

    Back to the top

    Powered by Savane 3.13-54b4.
    Corresponding source code