CACI-International / ergo

The ergo language and runtime.
MIT License
2 stars 2 forks source link

`ergo -d` weird pager behavior #9

Open calebzulawski opened 1 year ago

calebzulawski commented 1 year ago

A few related issues:

Functions

<80> chars: Create an iterator over the characters of a string. <80> compare: Compare two strings lexicographically. <80> from: Convert a value into a String. <80> join: Join an array of strings. <80> match: Match and decompose a string. <80> split: Split a string on a substring. <80> trim: Trim whitespace from the beginning and end of a string. ``` Even with less installed, the output doesn't go through the pager (it's printed directly to stdout), but there is a trailing newline...
calebzulawski commented 1 year ago

This seems to be somewhat related to the locale set to POSIX, setting it to C.UTF-8 properly renders the unicode symbols, but still writes directly to stdout. Maybe less is configurable?

afranchuk commented 1 year ago

The paging uses less -F, which will not page if the content will fit in the terminal. I'm not sure whether less is just a pass-through at that point or whether it may alter the input.

There's definitely nothing right now to not use unicode (and there's no way to check whether the terminal rendering will result in correct unicode output, since that goes into complicated font rendering/fallback behaviors). It would not be hard to have a flag to change the characters sets used.

calebzulawski commented 1 year ago

Odd, on my machine (ubuntu 22.04) it always pages (which I don't really mind) but it might be beneficial to use minus or similar to make the paging a little more uniform.

afranchuk commented 1 year ago

That is odd. Has ubuntu changed the default pager!? I know on mac their version of less is so incredibly old that it has a bug where -F doesn't work.

I'm not sure whether anyone uses PAGER in special ways or not (which the current approach respects), but an approach using minus would still allow a user to use their pager (they'd have to disable paging and pipe it themselves though). I suppose one of the larger advantages of PAGER is that it has familiar user keybindings and features. It's probably not a big loss to change though, I expect a huge portion of users simply only use arrow keys and maybe text search.