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

"Terminal does not support reporting screen size s via the TIOCGWINSZ ioctl" #8259

Open
alok opened this issue Apr 11, 2018 · 12 comments
Open
Labels
enhancement feature request terminal built-in :terminal or :shell
Milestone

Comments

@alok
Copy link

alok commented Apr 11, 2018

  • nvim --version: NVIM v0.2.3-975-g84bac9f50
  • Vim (version: ) behaves differently? Different error but doesn't work either
  • Operating system/version: macos 10.13
  • Terminal name/version: kitty
  • $TERM: xterm-256color

Steps to reproduce using nvim -u NORC

Requires kitty terminal emulator and its icat script

nvim -u NORC
:term
icat (some img file)

Actual behavior

Terminal does not support reporting screen sizes via the TIOCGWINSZ ioctl

Expected behavior

An image should be displayed.

@justinmk
Copy link
Member

Patch welcome

@alok

This comment was marked as outdated.

@justinmk
Copy link
Member

@alok src/nvim/terminal.c. Will need to use libvterm's vterm_state_set_unrecognised_fallbacks, I think. @leonerd does that sound correct?

@justinmk justinmk added terminal built-in :terminal or :shell enhancement feature request labels Apr 12, 2018
@justinmk justinmk added this to the todo milestone Apr 12, 2018
@leonerd
Copy link
Contributor

leonerd commented May 2, 2018

No, that's unrelated. You'll need to make the ioctl(TIOCSWINSZ, ...) call somewhere in nvim source. See for reference

https://bazaar.launchpad.net/~leonerd/pangoterm/trunk/view/head:/main.c#L62

@JudgeGregg
Copy link

Apparently there's already a TIOCSWINSZ callback in:

void pty_process_resize(PtyProcess *ptyproc, uint16_t width, uint16_t height)

However the icat script fails because it's expecting pixel width/height in addition to columns/lines.
Furthermore, even if I set the pixel size for a given neovim term, the script fails with "terminal does not support graphics, please use kitty".

It seems to be a much bigger change than expected.

@watersb
Copy link

watersb commented Feb 18, 2019

#include <stdio.h>
#include <string.h>
#include <sys/errno.h>
#include <sys/ioctl.h>

int main(void)
{
    struct winsize w;

    if (ioctl(1, TIOCGWINSZ, &w) < 0)
    {
        fprintf(stderr, "Couldn't get window size: %s\n", strerror(errno));
    }
    else
    {
        printf(
            "chars  w,h: %4u, %4u\npixels x,y: %4u, %4u\n",
            w.ws_row,
            w.ws_col,
            w.ws_xpixel,
            w.ws_ypixel);
    }

    return errno;
}

@alok
Copy link
Author

alok commented Dec 21, 2020

@justinmk @leonerd what work would be required to implement this? I finally learned C and may actually be able to implement this now.

@alok
Copy link
Author

alok commented Apr 4, 2021

I’m also willing to put out a $100 bounty on this.

@leonerd
Copy link
Contributor

leonerd commented Apr 4, 2021

If you need to know the pixel size then the best you can do is just have nvim ask the real terminal and then relay that information back. Be careful of screen -x and similar, though; because there may be multiple "real terminals" with multiple real sizes. This isn't a well-defined answer.

@max397574
Copy link
Contributor

any updates on this?

@justinmk
Copy link
Member

no

@ejuarezg
Copy link

I'm running into a similar issue, I believe, when running neovim inside a container in Fedora Silverblue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement feature request terminal built-in :terminal or :shell
Projects
None yet
Development

No branches or pull requests

7 participants