Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Italic and strikethrough doesn't seem to work #46

Open
C0DK opened this issue Oct 21, 2019 · 6 comments
Open

[BUG] Italic and strikethrough doesn't seem to work #46

C0DK opened this issue Oct 21, 2019 · 6 comments
Labels
bug Something isn't working

Comments

@C0DK
Copy link

C0DK commented Oct 21, 2019

Describe the bug
So i've been trying to produce italic font for quite some time, and trying to debug why it wouldn't display on my gocui application, but it seems to be a general problem with gocui - and I realized that you don't use neither in your example - so I realized the problem might be on your end. But i cant fathom what can possibly be the cause of it.
To Reproduce

the following doesn't use strikethrough or italic on my end.

// Copyright 2014 The gocui Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package main

import (
	"fmt"
	"log"

	"github.com/awesome-gocui/gocui"
)

func main() {
	g, err := gocui.NewGui(gocui.OutputNormal, true)
	if err != nil {
		log.Panicln(err)
	}
	defer g.Close()

	g.SetManagerFunc(layout)

	if err := g.SetKeybinding("", gocui.KeyCtrlC, gocui.ModNone, quit); err != nil {
		log.Panicln(err)
	}

	if err := g.MainLoop(); err != nil && !gocui.IsQuit(err) {
		log.Panicln(err)
	}
}

func layout(g *gocui.Gui) error {
	maxX, maxY := g.Size()
	if v, err := g.SetView("colors", maxX/2-7, maxY/2-12, maxX/2+7, maxY/2+13, 0); err != nil {
		if !gocui.IsUnknownView(err) {
			return err
		}
		for i := 0; i <= 7; i++ {
			for _, j := range []int{1, 3, 4, 7, 9} {
				fmt.Fprintf(v, "Hello \033[3%d;%dmcolors!\033[0m\n", i, j)
			}
		}
		if _, err := g.SetCurrentView("colors"); err != nil {
			return err
		}
	}
	return nil
}

func quit(g *gocui.Gui, v *gocui.View) error {
	return gocui.ErrQuit
}

Expected behavior

ANSI italic and strikethrough works.

Screenshots
image <- this picture should italic and strikethrough, but only has underscore and reverse
Environment (please complete the following information):

  • OS: Archlinux, running in alacritty. has also been tested in termite. both have italic and strikethrough working - just not in gocui
  • Version (not sure how to find
@C0DK C0DK added the bug Something isn't working label Oct 21, 2019
@C0DK
Copy link
Author

C0DK commented Oct 21, 2019

I assume it's because Termbox doesn't support it - though https://github.com/nsf/termbox-go/blob/5c94acc5e6eb520f1bcd183974e01171cc4c23b3/api_common.go#L155 - but it seems weird that they don't do that.. :/

@mjarkk
Copy link
Member

mjarkk commented Oct 21, 2019

From a quick search it seems like Italic and Strikethrough are not supported in some shells or work different and thus some shell will have wired art affects when using then, that's why they seem to be not supported.
And sadly we can't do a lot about it :(

But there is some hope, we are trying to switch to a different underlying library named tcell instaid of termbox to fix some issues like yours but this will take time and sadly strikethrough and italic are both not supported yet in tcell.
But because tcell is actively developed and there is an issue about it we might see this at some point supported in gocui but no promises.

If you want to know how far we are with switching to tcell and testing it see this PR: #45

@C0DK
Copy link
Author

C0DK commented Oct 22, 2019

Yeah i saw that tcell had the same problem. Do you need any small development help regarding the switch to Tcell? i need to create another PR for my hacktoberfest, and would gladly help here.

It seems that tcell have an open fork with both strikethrough and italic, so maybe we'll see it soon. i hope :D

@mjarkk
Copy link
Member

mjarkk commented Oct 22, 2019

If you want to help with #45 a pr is always welcome!
On the top of #45 there is a list of issues I've found and not yet fixed, if you want to help you could try to fix one of those or try to get an example project to work perfectly.

Make sure to fork my fork and create a pr there, the tcell branch was created in my fork to keep this repo clean

@C0DK
Copy link
Author

C0DK commented Oct 23, 2019

will do!

@MichaelMure
Copy link

Completely unrelated to this particular issue, but I just wanted to drop by and say that it's awesome to see you guys organize and fill the gap to push gocui further. Very much appreciated ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants