Terminal-Print icon indicating copy to clipboard operation
Terminal-Print copied to clipboard

Choose defaults for expected terminal features

Open japhb opened this issue 8 years ago • 3 comments

At this point, we should probably assume that the user's terminal supports more than 16 colors unless we have evidence to the contrary; sadly there's no way to reliably and portably detect this without asking the user. Likewise we should assume the user's terminal and installed fonts have support for a reasonable set of Unicode characters, not just plain 7-bit ASCII; again there's no good way to detect this reliably and portably, because even if you can prove the terminal supports the most recent Unicode character set, it still doesn't tell you if the terminal font has the proper glyphs rather than a bunch of boxes.

Unless someone actively disagrees, I'll assume:

  • Most terminals support at least 256 colors, but it must be possible to force 16-color mode if needed
  • Most terminals support Unicode as their default character set, but it must be possible to force ASCII-only (or CP 437 eventually) if needed
  • Unicode fonts will most likely include at least:
  • If the terminal's font doesn't support the above, it's OK to put the onus on the user to fix that situation or fall back to e.g. ASCII

japhb avatar Dec 28 '16 01:12 japhb

Eventually, it might be wise to include a test suite that will run tests designed for a user to know their terminal's capabilities and report that back to T::P.

Aside from that, I don't find anything wrong with your current assumptions.

  • X/C

On Tue, Dec 27, 2016 at 8:17 PM, japhb [email protected] wrote:

At this point, we should probably assume that the user's terminal supports more than 16 colors unless we have evidence to the contrary; sadly there's no way to reliably and portably detect this without asking the user. Likewise we should assume the user's terminal and installed fonts have support for a reasonable set of Unicode characters, not just plain 7-bit ASCII; again there's no good way to detect this reliably and portably, because even if you can prove the terminal supports the most recent Unicode character set, it still doesn't tell you if the terminal font has the proper glyphs rather than a bunch of boxes.

Unless someone actively disagrees, I'll assume:

  • Most terminals support at least 256 colors, but it must be possible to force 16-color mode if needed
  • Most terminals support Unicode as their default character set, but it must be possible to force ASCII-only (or CP 437 eventually) if needed
  • Unicode fonts will most likely include at least:
  • If the terminal's font doesn't support the above, it's OK to put the onus on the user to fix that situation or fall back to e.g. ASCII

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ab5tract/Terminal-Print/issues/35, or mute the thread https://github.com/notifications/unsubscribe-auth/AAlOwjUUm-UPQ8Iby9F-aR24OH0xhGkrks5rMbihgaJpZM4LWmvD .

Xliff avatar Dec 28 '16 01:12 Xliff

@Xliff I really like this idea of yours.

ab5tract avatar Aug 22 '17 17:08 ab5tract

@ab5tract - Darn you! Now I need to figure out how to do it! :P

Xliff avatar Aug 22 '17 18:08 Xliff