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

mouse sending random characters to the terminal after examples/minimal ends #316

Closed
wmarini opened this issue Oct 17, 2023 · 8 comments
Closed
Labels
bug Something isn't working

Comments

@wmarini
Copy link

wmarini commented Oct 17, 2023

Hello! I compiled the latest commit on my Ubuntu 22.04.3 Linux machine. After compiling, I found an issue with the "examples/minimal" program. When it finishes running, the mouse causes the terminal to display random characters when one of its button is pressed.

image

See below how to reproduce this issue:

$ git log -n 1 --oneline
$ git status
# moving to the `build` directory
$ cd ../build/cpp-terminal-master
$ cmake --build . --target clean
$ cmake --build .
$ examples/minimal

Full output (before I lost control of the mouse in that terminal):

wmarini@mineta:~/installs/cpp-terminal$ git log -n 1 --oneline
6059c0d (HEAD -> master, origin/master, origin/HEAD) Update attach_console_minimal.cpp
wmarini@mineta:~/installs/cpp-terminal$ git status
On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean
wmarini@mineta:~/installs/cpp-terminal$ cd ../build/cpp-terminal-master
wmarini@mineta:~/installs/build/cpp-terminal-master$ cmake --build . --target clean
[2/2] Cleaning all built files...
Cleaning... 91 files.
wmarini@mineta:~/installs/build/cpp-terminal-master$ cmake --build .
[14/85] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/event.cpp.o
/home/wmarini/installs/cpp-terminal/cpp-terminal/event.cpp: In member function ‘void Term::Event::parse(const string&)’:
/home/wmarini/installs/cpp-terminal/cpp-terminal/event.cpp:279:24: warning: ‘type’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  279 |     Term::Button::Type type;
      |                        ^~~~
[24/85] Building CXX object cpp-terminal/platforms/CMakeFiles/cpp-terminal-platforms.dir/sigwinch.cpp.o
/home/wmarini/installs/cpp-terminal/cpp-terminal/platforms/sigwinch.cpp: In static member function ‘static bool Term::Private::Sigwinch::isSigwinch(const int&)’:
/home/wmarini/installs/cpp-terminal/cpp-terminal/platforms/sigwinch.cpp:101:11: warning: ignoring return value of ‘ssize_t read(int, void*, size_t)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
  101 |     ::read(m_fd, &fdsi, sizeof(fdsi));
      |     ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
[85/85] Linking CXX executable tests/Events

@certik
Copy link
Collaborator

certik commented Oct 17, 2023

@wmarini thanks! I think this was probably caused by #309.

@flagarde, do you think you could please have a look?

@flagarde
Copy link
Collaborator

@certik @wmarini Sure, I will have a look. This mouse event support is quite new and not yet bulletproof. Thx for the test and the feedback

@flagarde
Copy link
Collaborator

@wmarini could you tell me what terminal are you using ?

@flagarde flagarde added the bug Something isn't working label Oct 17, 2023
flagarde added a commit that referenced this issue Oct 17, 2023
@flagarde
Copy link
Collaborator

@wmarini I found the problem and pushed a very naive fix. Please have a try

@wmarini
Copy link
Author

wmarini commented Oct 17, 2023

@wmarini could you tell me what terminal are you using ?

It's a gnome-terminal.

$ echo $TERM
xterm-256color
$ echo $SHELL
/bin/bash
$ tty
/dev/pts/1

@flagarde
Copy link
Collaborator

@wmarini could you tell me what terminal are you using ?

It's a gnome-terminal.

$ echo $TERM
xterm-256color
$ echo $SHELL
/bin/bash
$ tty
/dev/pts/1

Thx I did some basic test with this terminal. Most of the problem reported should be fixed. There is still corner cases but I need more time to investigate. But the last commits should solve the issue you posted

@wmarini
Copy link
Author

wmarini commented Oct 18, 2023

@wmarini could you tell me what terminal are you using ?

It's a gnome-terminal.

$ echo $TERM
xterm-256color
$ echo $SHELL
/bin/bash
$ tty
/dev/pts/1

Thx I did some basic test with this terminal. Most of the problem reported should be fixed. There is still corner cases but I need more time to investigate. But the last commits should solve the issue you posted

Yes, it 's fixed! A quick test with the last commit and that's working fine now! ;) Thank you!

@flagarde
Copy link
Collaborator

@wmarini Closing the issue then, thank you for the report

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