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

Support 256color #82

Merged
merged 6 commits into from
Jul 30, 2019
Merged

Support 256color #82

merged 6 commits into from
Jul 30, 2019

Conversation

jixiuf
Copy link
Collaborator

@jixiuf jixiuf commented Apr 22, 2019

#58

@suonlight
Copy link
Contributor

It works fine for me. Thank you @jixiuf

@Sbozzolo
Copy link
Collaborator

I tried this patch. I don't see any changes in the visual appearance (which is still broken with solarized, the theme I am using).

@suonlight
Copy link
Contributor

@Sbozzolo: What is your term currently? echo $TERM to know that.

@Sbozzolo
Copy link
Collaborator

xterm-256colors

@suonlight
Copy link
Contributor

My term is export TERM=xterm-256color. Can you remove s at the end of your term?

@Sbozzolo
Copy link
Collaborator

Actually, I miscopied, it is without the "s".

2019-04-22:20:57:11

@suonlight
Copy link
Contributor

You use curl -s https://gist.githubusercontent.com/HaleTom/89ffe32783f89f403bba96bd7bcd1263/raw/ | bash to test 256 colors.

Screenshot 2019-04-23 10 59 01

@Sbozzolo
Copy link
Collaborator

I see 256 colors, but some of them look different if a run the script with ansi-term.

2019-04-22:21:04:33

@suonlight
Copy link
Contributor

Do you set ansi colors like (setq ansi-color-names-vector ["#292b2d" "#ce527a" "#2d9474" "#bfa325" "#4e97d6" "#bb6dc3" "#299ba2" "#e4e4e4"])

Screenshot 2019-04-23 11 10 45

@suonlight
Copy link
Contributor

I have set the same ansi colors for both emacs and iterm

@Sbozzolo
Copy link
Collaborator

Sbozzolo commented Apr 23, 2019 via email

@jixiuf
Copy link
Collaborator Author

jixiuf commented Apr 23, 2019

I think the 8 color in ansi-color-names-vector is not enough
we need define two face for default background and default foreground

https://github.com/akermu/emacs-libvterm/blob/master/vterm-module.c#L460
https://github.com/akermu/emacs-libvterm/blob/master/vterm-module.c#L464
is not correct

maybe we need revert 39d4c44 and 976c3f2
maybe we can do something like ansi-term-color-vector in term.el

;;; Faces
(defvar ansi-term-color-vector
  [term
   term-color-black
   term-color-red
   term-color-green
   term-color-yellow
   term-color-blue
   term-color-magenta
   term-color-cyan
   term-color-white])

EDIT:
actually ansi-term use ansi-term-color-vector in term.el
and vterm use ansi-color-names-vector in ansi-color.el.gz
the default value of them is different
now I add vterm-color-palette and vterm-color-default ,you can custom these faces

the default value of faces in vterm-color-palette is inherited from ansi-color-names-vector

@Sbozzolo you can custom vterm faces after load your theme like this

(set-face-attribute 'vterm-color-black nil :background nil :foreground nil :inherit 'term-color-black)
(set-face-attribute 'vterm-color-red nil :background nil :foreground nil :inherit 'term-color-red)
(set-face-attribute 'vterm-color-green nil :background nil :foreground nil :inherit 'term-color-green)
(set-face-attribute 'vterm-color-yellow nil :background nil :foreground nil :inherit 'term-color-yellow)
(set-face-attribute 'vterm-color-blue nil :background nil :foreground nil :inherit 'term-color-blue)
(set-face-attribute 'vterm-color-magenta nil :background nil :foreground nil :inherit 'term-color-magenta)
(set-face-attribute 'vterm-color-cyan nil :background nil :foreground nil :inherit 'term-color-cyan)
(set-face-attribute 'vterm-color-white nil :background nil :foreground nil :inherit 'term-color-white)

;;maybe need after  (require 'term)
(set-face-attribute 'vterm-color-default nil :background nil :foreground nil :inherit 'term)

@jixiuf jixiuf force-pushed the support-256color branch 2 times, most recently from a4cd12d to 3a2a5d9 Compare April 23, 2019 16:23
@Sbozzolo
Copy link
Collaborator

I checked out the latest commit, and I was extremely happy to see that it works!
I didn't add any of @jixiuf customizations.

Screenshot to compare XTerm, VTerm and term:

2019-04-25:20:27:48

@Sbozzolo
Copy link
Collaborator

Small problem with htop:

(Top pane is vterm, some strings are unreadable. Bottom is xterm)

2019-04-25:20:51:48

@jixiuf jixiuf force-pushed the support-256color branch 2 times, most recently from 280f7b6 to 7a4220e Compare April 26, 2019 15:20
@jixiuf
Copy link
Collaborator Author

jixiuf commented Apr 26, 2019

can not reproduced with theme color-theme-sanityinc-solarized @Sbozzolo

@Sbozzolo
Copy link
Collaborator

Sbozzolo commented Apr 26, 2019 via email

@jixiuf
Copy link
Collaborator Author

jixiuf commented Apr 26, 2019

can you try to run make run in emacs-libvterm/build directory

and install color-theme-sanityinc-solarized

@Sbozzolo
Copy link
Collaborator

I performed some tests. If load emacs with the theme and vterm only, then I get the screenshot above. If I load emacs with vterm, and once emacs is running I load the theme, then the colors are slightly different, and the column name in htop are readable.

Do you have suggestions for understanding what is going on?

@jixiuf
Copy link
Collaborator Author

jixiuf commented Apr 27, 2019

trying change the order of loading vterm and your theme, and see what's going on ,
and trying load your theme in after-init-hook and see what's going on

(add-hook 'after-init-hook (lambda () (load-theme 'solarized-light)))

@Sbozzolo
Copy link
Collaborator

Sbozzolo commented Apr 27, 2019

Changing order, or using the lambda you posted changes nothing.
However, I noticed that if I remove my .Xresources, both the scenarios (loading in the init or after) yield the same result: wrong colors.

@akermu
Copy link
Owner

akermu commented Apr 28, 2019

@jixiuf Is this ready to be reviewed or are you still working on this?

@jixiuf
Copy link
Collaborator Author

jixiuf commented Apr 29, 2019

I rebased the code ,and now is ready to be reviewed

@jixiuf jixiuf force-pushed the support-256color branch 4 times, most recently from e455410 to 3ae88ca Compare May 3, 2019 03:31
@qhuyduong
Copy link

@jixiuf I'm facing this issue with Emacs 26.2. I'm using latest code. Any idea?

Error running timer ‘vterm--delayed-redraw’: (void-function vterm--get-color) [2 times]
Error during redisplay: (vterm--window-size-change-26 #<frame vterm<2> – Doom Emacs 0x10614dcb8>) signaled (void-function vterm--get-color)

@jixiuf
Copy link
Collaborator Author

jixiuf commented May 4, 2019

@jixiuf I'm facing this issue with Emacs 26.2. I'm using latest code. Any idea?

Error running timer ‘vterm--delayed-redraw’: (void-function vterm--get-color) [2 times]
Error during redisplay: (vterm--window-size-change-26 #<frame vterm<2> – Doom Emacs 0x10614dcb8>) signaled (void-function vterm--get-color)

@qhuyduong
are you sure you are using the last version vterm.el in this pull request,
vterm--get-color is defined in vterm.el
make sure you are loading the right vterm.el

@qhuyduong
Copy link

@jixiuf my bad. I just build and update vterm-module.so without updating vterm.el. Thank you very much :D

@Sbozzolo
Copy link
Collaborator

I don't know if the following comment is needed/wanted/welcomed, but:
I've been using this patch on a daily basis for several weeks now.
While the color rendering is still not perfect, on my system it is a massive improvement compared to the out-of-the-box experience.

@jixiuf
Copy link
Collaborator Author

jixiuf commented Jul 11, 2019

after last commit ,the bug should be fixed.
because the color are inherited from term.el ,so we should require term.el .
I don't know is this a good idea.

or maybe we can create PR to different theme packages for this package instead of require term.el

@Sbozzolo
Copy link
Collaborator

Sbozzolo commented Jul 12, 2019

I checked out the latest commit. There are still imperfections in the rendering.
For instance, see the attached screenshot, there is an autosuggestion that is barely visible.
What should happen is that the suggested continuation should be lighter compared to the command already typed in, with the previous commit it was of the same weight, as you can see in the second attached screenshot. What I would like is more akin the last screenshot (where it is clear that there is a suggestion).

Btw: thanks for all your contributions to this package, they are invaluable!

2019-07-12:12:05:19

2019-07-12:12:07:52

2019-07-12:12:08:38

@jixiuf
Copy link
Collaborator Author

jixiuf commented Jul 12, 2019

I compare vterm and iterm2 ,and found they both are imperfections in the rendering ,like the first screenshot you attached. so I thinks it should be the problem of the theme.
Btw: is the third screenshot using solarized theme, and I found the colors are different with screenshot1 and screenshot2.

@jixiuf jixiuf force-pushed the support-256color branch from b3bcd8e to 797db6b Compare July 18, 2019 15:51
@jixiuf
Copy link
Collaborator Author

jixiuf commented Jul 18, 2019

rebase the code.

@jixiuf jixiuf force-pushed the support-256color branch from 797db6b to 7ded6fb Compare July 30, 2019 14:02
Copy link
Owner

@akermu akermu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice, thanks a lot!

@akermu akermu merged commit 4d34280 into akermu:master Jul 30, 2019
@akermu akermu mentioned this pull request Jul 30, 2019
@jixiuf jixiuf deleted the support-256color branch August 2, 2019 03:00
@akermu akermu mentioned this pull request Aug 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants