Bladeren bron

Use available terminal columns instead of hardcoded 80 columns (#11404)

* Use available terminal columns instead of hardcoded 80 columns

* hotfix on phone

* embrace laziness

---------

Co-authored-by: Rudy G <[email protected]>
Co-authored-by: Simon Krajewski <[email protected]>
Rudy Ges 1 jaar geleden
bovenliggende
commit
b588672b96
3 gewijzigde bestanden met toevoegingen van 5 en 2 verwijderingen
  1. 1 0
      haxe.opam
  2. 3 1
      src/compiler/args.ml
  3. 1 1
      src/dune

+ 1 - 0
haxe.opam

@@ -33,4 +33,5 @@ depends: [
   "conf-neko"
   "luv" {>= "0.5.12"}
   "ipaddr"
+  "terminal_size"
 ]

+ 3 - 1
src/compiler/args.ml

@@ -2,8 +2,10 @@ open Globals
 open Common
 open CompilationContext
 
+let columns = lazy (match Terminal_size.get_columns () with None -> 80 | Some c -> c)
+
 let limit_string s offset =
-	let rest = 80 - offset in
+	let rest = (Lazy.force columns) - offset in
 	let words = ExtString.String.nsplit s " " in
 	let rec loop i words = match words with
 		| word :: words ->

+ 1 - 1
src/dune

@@ -20,7 +20,7 @@
 		extc extproc extlib_leftovers ilib javalib mbedtls neko objsize pcre2 camlp-streams swflib ttflib ziplib
 		json
 		unix ipaddr str bigarray threads dynlink
-		xml-light extlib sha
+		xml-light extlib sha terminal_size
 		luv
 	)
 	(modules (:standard \ haxe))