Giter VIP home page Giter VIP logo

Comments (5)

sg-s avatar sg-s commented on August 18, 2024

yeah, i see this too.

from lsp.

dborzov avatar dborzov commented on August 18, 2024

This is a major issue that really affects user experience. I will need to address it first, thanks for bringing it up.

from lsp.

BAXTER001 avatar BAXTER001 commented on August 18, 2024

If you can point me to the section to stare at I'd be happy to give a fix a go.

from lsp.

dborzov avatar dborzov commented on August 18, 2024

Wow, that would have been amazing, thanks @BAXTER001 ! The func in question is in fmt.go@PrintColumns(filename, description string).

There is this complication that I use colorstring library that converts colour tags within the string into escape characters to show coloured text in shell:

   fmt.Println(colorstring.Color("[blue]Hello [red]World!"))

These colour tags skew off the string lengths. Not sure how to bypass that easily at this stage. Maybe use other shell coloring library with a different syntax?

Maybe add a new ShellString type:

        type struct ShellString {
            s string
            color string
        }

        func (s ShellString) String() string {
            return colorstring.Color("["+s.color+"]"+  s.s) 
       }

        func (s ShellString) Length() string {
            return strings.RuneCountInString(s.s) 
       }

I think that would be the most idiomatic go way (see e.g. NullString in database/sql package) but that is quite a lot of refactoring.

from lsp.

dborzov avatar dborzov commented on August 18, 2024

While we are at it, we can also make it support general number of columns, not just two. Something like PrintColumns(columns []string) instead of PrintColumns(filename, description string).

Should have done this right at the time. But nooo 😜

from lsp.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.