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

geany F5 trouble (command works only the first time) #2738

Closed
reregaga opened this issue Jan 27, 2021 · 3 comments
Closed

geany F5 trouble (command works only the first time) #2738

reregaga opened this issue Jan 27, 2021 · 3 comments
Labels

Comments

@reregaga
Copy link

geany F5 trouble

Description of problem

F5 - works only the first time
restarting F5 is possible only if you press ENTER in the "terminal" window or enter command, example 'clear'

Video

geany_F5_trouble.webm.mp4

What i want

work every time a button F5 is pressed

Environment

tested on all geany versions
geany 0.21, 1.22, 1.23, 1.24

Slackware 12.2
TDE-3.5.12
terminal client: konsole/kde3

@elextr
Copy link
Member

elextr commented Jan 27, 2021

This is intended behaviour, Geany only allows one execute at a time and you may notice that the menu and toolbar icon changes to some form of stop or cancel icon which if pressed will kill the terminal, and so the running process (in case your new program gets into an infinite loop :) and when you close the terminal (after you have read the messages your program printed) the icon reverts and a new execute can happen.

However some terminal emulators circumvent this behaviour. Instead of running a new window they open a new tab in an existing terminal emulator window and exit immediately, telling Geany that the execute is finished so a new execute can start but losing the kill ability.

IIRC the KDE terminal emulator is one of those, and thats likely the behaviour you have been seeing in the past if there was already a terminal running. But, if the terminal Geany runs happens to be the first one opened, it of course has to open a window and it keeps running, so Geany behaves as expected since the terminal process doesn't close immediately.

@elextr elextr closed this as completed Jan 27, 2021
@elextr elextr added the invalid label Jan 27, 2021
@reregaga
Copy link
Author

reregaga commented Jan 28, 2021

Thank @elextr for your detailed answer, if I understood you correctly, it is impossible to run several programs in parallel and I agree with that.

But I would like to avoid pressing the Enter key between two consecutive runs of the same program.

For example, right now it looks like this:

  1. press F5.
  2. program1 runs and finishes
  3. HAVE to forcibly click on "embedded terminal" (very uncomfortable, I could not find shortcut to switch, and this is very uncomfortable to switch with mouse)
  4. Press Enter for new line or input 'clear' in terminal, because otherwise F5 doesn't work.
  5. Press F5 (focus "without our knowledge" automatically switches to the code editor, which is also very uncomfortable, you need a setting to "regulate this behavior")
  6. program1 runs and finishes

I would like:

  1. press F5
  2. program1 runs and finishes
  3. press F5
  4. program1 runs and finishes

Is it possible?

@elextr
Copy link
Member

elextr commented Jan 28, 2021

Ahh, you are talking about running in the embedded terminal widget (VTE), that wasn't clear from the screenshot and your listing konsole as the terminal.

This is a different problem, Geany just sends a command to VTE, it doesn't run the command, and VTE doesn't run the command either, the shell already running inside it does, and that does not have a way of communicating the process ID back to VTE for it to communicate it back to Geany, so neither VTE nor Geany can wait on completion since they do not know which process ID to wait on. So Geany doesn't wait for completion when running in VTE and the execute icon will never change to kill as Geany has no idea which process ID to kill.

But the user can also type into the VTE widget, and as Geany can't remove those characters, any stray characters will get appended to the command. So there is the concept of the terminal being "clean", where to the best of Geany's knowledge nothing has been typed in VTE since the last command or enter or ctrl+c, all of which should cause any input to be consumed/ignored by the shell. If VTE isn't "clean" Geany asks you to clean it before it will attempt to run the command and confirm by enter or ctrl+c. But this is a bit of a heuristic, its not perfect.

For me it works the way you would like. F5, program runs and finishes, F5, program runs and finishes.

There is a keybinding to switch to the VTE (bound to F4 by default) and there is a keybinding to switch to the editor (bound to F2 by default). But within VTE only the minimal keybindings work, to avoid stealing them from the program running there which may use them. IIRC the (default F2) switch to editor is one of the few that work and F5 deliberately doesn't along with most of the other keybindings.

For me a program that needs user input works as F5, program runs until input needed, F4, type input, enter, program completes, F2, F5 ... rinse and repeat.

So your continual need to clean VTE means somehow you are getting VTE "unclean" by typing in VTE between commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants