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
add libvterm support #1212
add libvterm support #1212
Conversation
Perhaps the right thing to do is leave this in a feature branch while the kinks are worked through. |
@shaleh ok I will work some more on this. Can you please take a look at configure.ac. I don't know why |
@brotzeit I pushed a fix to the configure script and used it to make vterm.c become empty if libvterm is not found. That may need some tweaking, but the detection is now solid.
When |
Ok, I just pushed some changes that should enable you to allocate the |
@shaleh Thanks. Your changes regarding the pseudovector were the same as mine, but it didn't work when I tried this because we didn't tag. With |
@brotzeit you also missed adding the header to the top of |
No, I had that one. First post after your last post in #1130 ;) I guess without that it wouldn't have run in the first place. It was just the segfault after a few insertions when Tagging solved the problem. I wonder if pub fn from_ptr(ptr: *mut c_void) -> Option<Self> {
unsafe { ptr.as_ref().map(|p| mem::transmute(p)) }
} is also a source of potential problems ? |
Yeah, can be potentially dangerous if the wrong type is used. However, it is taking a pointer after it has been untagged. And the object returned should be retagged. If that is true it is safe. |
rust_src/build.rs
Outdated
fn ignore(path: &str) -> bool { | ||
path == "" || path.starts_with('.') || path == "lib.rs" || path == "functions.rs" | ||
} | ||
|
||
#[cfg(not(feature = "libvterm"))] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of repeating the base ignore
maybe you should make a base_ignore
which is all that the vterm version uses and the non-vterm version is it plus vterm.rs.
rust_src/src/vterm.rs
Outdated
@@ -53,9 +53,9 @@ impl LispVterminalRef { | |||
(height, width) | |||
} | |||
|
|||
pub fn set_size(self, rows: EmacsInt, cols: EmacsInt) { | |||
pub fn set_size(self, rows: c_int, cols: c_int) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to continue using c_int
or should we transition to i32
?
I have another problem that confuses me. When I use |
And resizing horizontally after window size change also doesn't work correctly. |
|
Hrm.. werird. That should set both height and width at the same time. Do you have a link to the relevant code? I can't see a call to |
|
||
pub fn set_size(self, rows: i32, cols: i32) { | ||
unsafe { | ||
vterm_set_size((*self).vt, rows, cols); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@leonerd Here. When I resize the window while htop is running it only updates the height. But when I exit htop and run it again it also gets the correct width. Maybe the reason is how emacs handles resizing...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue is caused by the COLUMNS
and LINES
environment variable. Unset these before invoking htop and resizing will work.
0b08cb7
to
35a228a
Compare
I wonder if it wouldn't be better to vendor libvterm. neovim and emacs-libvterm both do it this way and it seems this is the reason why libvterm isn't up to date in the package repos. The arch linux package is orphaned. I could take care of the arch linux package, but what's with the other distros. What do you think ? |
I don't know quite what "vendoring" means, but generally at the moment you want to be taking yourself a static snapshot of whatever version you've written code against, and only update that when you're updating code at the same time. Until I get around to actually stablising any last bits of API I know I'm going to be changing in future, I am not making version-numbered releases of libvterm. Best is to keep that static snapshot so you know APIs aren't going to change underneath you. |
@leonerd I have read the term in neovim and emacs-libvterm so I thought this describes what we both mean ;) But that's what I thought. Thanks. |
@shaleh Can you give me some source on how to add this to the build process. I was hoping I can take this from emacs-libvterm but I guess I can't use this cmake stuff ? |
My expectation is the user first builds the vterm library and puts it somewhere linkable. For instance in /usr/local/lib. Then they build remacs and the remacs configure script will find and set up the linking for vterm. Does this match your expectation @brotzeit? This is how I am accustomed to handling C/C++ libraries in other open source projects. Look at the configure script for remacs. It fails and says "go figure libjpeg out and come back". Welcome to the days before bundling. The user was expected to either use a tool like apt/yum/whatever or to download and compile the package. Once done you go back and try again. Repeat until all dependencies are installed or you give up and use something already packaged. |
The only problem I see is that users get the wrong version for our remacs implementation. That's the reason why you told me to add libvterm to the remacs organization right ? |
Having the crate in the remacs org makes keeping the versions in sync easier. The user installs the vterm lib and then builds remacs. |
I gave up with libvterm as a submodule. It seemed to me like a nice idea, but I don't get how this works. I think with @akermu 's fixes it works pretty well. It would be great if we could start the final review. |
7ba4871
to
f72b63e
Compare
c622d83
to
852a27a
Compare
Scrollback still needs fixing, but since we make this optional this should be ok. We just mention in the readme libvterm support is not stable. Maybe some users get motivated to help with it when they see it works. |
7110c47
to
9a60b44
Compare
It might be of interest to you folks that I've now made a v0.1 tarball release. Though bits of API are still verymuch subject to change, so expect that v0.2 will probably have some incompatible bits in it. |
I have a TODO list of the review from the old PR, but I would like to get this merged as I still hope I get some help with this =)
However I still have problems with configure.ac. I can't get this to work.
.rustified_enum("VTermProp")
doesn't work since #1185. It worked before...Apart from that, it seems to be usable. But resizing needs to get fixed.