@@ -21,7 +21,6 @@ import (
2121 fn "github.com/nxtcoder17/runfile/pkg/functions"
2222 "github.com/nxtcoder17/runfile/pkg/runfile/spec"
2323 "github.com/nxtcoder17/runfile/pkg/writer"
24- "golang.org/x/term"
2524)
2625
2726type TaskContext struct {
@@ -278,33 +277,6 @@ func CreateCommand(ctx context.Context, args CmdArgs) *exec.Cmd {
278277}
279278
280279func printCommand (w * writer.LogWriter , prefix , lang , cmd string ) {
281- borderColor := "#4388cc"
282- switch os .Getenv ("RUNFILE_THEME" ) {
283- case "light" :
284- borderColor = "#3d5485"
285- }
286-
287- myBorder := lipgloss.Border {
288- Top : "-+" ,
289- Bottom : "-+" ,
290- Left : "|" ,
291- Right : "|" ,
292- TopLeft : "+" ,
293- TopRight : "+" ,
294- BottomLeft : "+" ,
295- BottomRight : "+" ,
296- }
297-
298- s := lipgloss .NewStyle ().Border (myBorder ).BorderForeground (lipgloss .Color (borderColor )).PaddingLeft (1 ).PaddingRight (1 )
299- defer s .UnsetBorderStyle ()
300- defer s .UnsetPadding ()
301-
302- width := 0
303-
304- if term .IsTerminal (0 ) {
305- width , _ , _ = term .GetSize (0 )
306- }
307-
308280 hlCode := new (bytes.Buffer )
309281 cmdStr := strings .TrimSpace (cmd )
310282
@@ -317,28 +289,9 @@ func printCommand(w *writer.LogWriter, prefix, lang, cmd string) {
317289 hlCode .WriteString (cmdStr )
318290 }
319291
320- // Use display width so unicode prefixes like "≫" don't skew the box layout.
321- longestLen := longestLineWidth (cmd ) + prefixDisplayWidth (prefix )
322-
323- if width > 0 && longestLen >= width - 2 {
324- s = s .Width (width - 2 )
325- }
326-
327292 // w.Mu.Lock()
328293 // defer w.Mu.Unlock()
329- fmt .Fprintf (w , "\r \033 [K%s%s\n " , padString (s .Render (hlCode .String ()), prefix ), s .UnsetBorderStyle ())
330- }
331-
332- func longestLineWidth (str string ) int {
333- sp := strings .Split (str , "\n " )
334- l := lipgloss .Width (sp [0 ])
335- for i := 1 ; i < len (sp ); i ++ {
336- if lipgloss .Width (sp [i ]) > l {
337- l = lipgloss .Width (sp [i ])
338- }
339- }
340-
341- return l
294+ fmt .Fprintf (w , "\r \033 [K%s\n " , padString (hlCode .String (), prefix ))
342295}
343296
344297func padString (str string , withPrefix string ) string {
0 commit comments