@@ -21,14 +21,18 @@ var (
2121 "prompt-loading" , false ,
2222 "is prompt query not yet done rendering" ,
2323 )
24- flgRColorMode = cmdRender .PersistentFlags ().String (
25- "color -mode" , "none" ,
26- "color rendering mode of the prompt (zsh, ascii, none)" ,
24+ flgREscapeMode = cmdRender .PersistentFlags ().String (
25+ "escape -mode" , "none" ,
26+ "color / escape rendering mode of the prompt (zsh, ascii, none)" ,
2727 )
2828 flgRMode = cmdRender .PersistentFlags ().String (
2929 "prompt-mode" , "normal" ,
3030 "mode of the prompt (normal, edit)" ,
3131 )
32+ flgRPromptStartMark = cmdRender .PersistentFlags ().String (
33+ "prompt-mark-start" , "" ,
34+ "mark to place at the start of the prompt (first prompt line)" ,
35+ )
3236)
3337
3438func init () {
@@ -61,7 +65,7 @@ func setColorMode(mode string) {
6165 magentaC = wrapC ("%F{magenta}" , "%F{reset}" )
6266 greyC = wrapC ("%F{black}" , "%F{reset}" )
6367 newline = "\n %{\r %}"
64-
68+
6569 } else if mode == "ascii" {
6670 redC = color .Red .Render
6771 greenC = color .Green .Render
@@ -74,7 +78,7 @@ func setColorMode(mode string) {
7478}
7579
7680func cmdRenderRun (_ * cobra.Command , _ []string ) error {
77- setColorMode (* flgRColorMode )
81+ setColorMode (* flgREscapeMode )
7882
7983 if _ , err := os .Stdin .Stat (); err != nil {
8084 fmt .Printf ("%#v" , err )
@@ -258,7 +262,14 @@ func cmdRenderRun(_ *cobra.Command, _ []string) error {
258262 }
259263 promptLines = append (promptLines , promptMarker )
260264
261- fmt .Print (strings .Join (promptLines , newline ))
265+ // Add prompt mark to last line
266+ lastLine := len (promptLines ) - 1
267+ if lastLine >= 0 {
268+ promptLines [lastLine ] = fmt .Sprintf ("%v%v" , * flgRPromptStartMark , promptLines [lastLine ])
269+ }
270+
271+ fullPrompt := strings .Join (promptLines , newline )
272+ fmt .Print (fullPrompt )
262273
263274 return nil
264275}
0 commit comments