Thread overview
[OT] Is this a feature is any Linux terminal?
Oct 15, 2018
Basile B.
Oct 15, 2018
Gerald
October 14, 2018
Was just thinking about this: I've often liked the idea of having a terminal emulator built-into my code editor, so it could auto-highlight errors/etc and do jump-to-line on ANY variation of build command, without having to set up a custom build tool in the editor for "the is the exact command to build my project". (Yes, Iknow that full IDEs...and even many editors support jump-to-line, but they generally don't support running arbitrary modifications of commands without manually setting up ahead of time a very specific instance of a command).

But it just occurred to me: There's no reason any ordinary terminal emulator couldn't be written to do the same thing. A setting for a custom regex to look for, another setting for a command to run when the line is clicked on. That should be about it. The user's editor would have to support some kind of "editor --jump-to..." feature, but aside from that...well, why the heck not?

The terminal emulator I've been using (Konsole) doesn't appear to have anything like that, AFAICT. But I'm not really married to Konsole. Anyone know of another terminal with a feature like this?
October 15, 2018
On Sunday, 14 October 2018 at 23:28:04 UTC, Nick Sabalausky (Abscissa) wrote:
> Was just thinking about this: I've often liked the idea of having a terminal emulator built-into my code editor, so it could auto-highlight errors/etc and do jump-to-line on ANY variation of build command, without having to set up a custom build tool in the editor for "the is the exact command to build my project". (Yes, Iknow that full IDEs...and even many editors support jump-to-line, but they generally don't support running arbitrary modifications of commands without manually setting up ahead of time a very specific instance of a command).
>
> But it just occurred to me: There's no reason any ordinary terminal emulator couldn't be written to do the same thing. A setting for a custom regex to look for, another setting for a command to run when the line is clicked on. That should be about it. The user's editor would have to support some kind of "editor --jump-to..." feature, but aside from that...well, why the heck not?
>
> The terminal emulator I've been using (Konsole) doesn't appear to have anything like that, AFAICT. But I'm not really married to Konsole. Anyone know of another terminal with a feature like this?

VTE can certainly do this. It's the library many people use to embed a terminal in their app (or to make terminals, like Tilix). You can look at the API to get a better idea of what's possible https://developer.gnome.org/vte/0.48/VteTerminal.html. Click on message is certainly possible.

I use VTE in Coedit but so far the only advanced feature is that it follows the projects path and/or the editor file path dynamically. Useful but far from what you describe, which is done elsewhere.

I think that Konsole must be based on something similar to VTE (i.e a library) because the way it's integrated in Dolphin for example shows that it's not just a window that's hosted (it follows the path selected in the explorer... oh i remember where i stole the idea now...)
October 15, 2018
On Sunday, 14 October 2018 at 23:28:04 UTC, Nick Sabalausky (Abscissa) wrote:
> But it just occurred to me: There's no reason any ordinary terminal emulator couldn't be written to do the same thing. A setting for a custom regex to look for, another setting for a command to run when the line is clicked on. That should be about it. The user's editor would have to support some kind of "editor --jump-to..." feature, but aside from that...well, why the heck not?
>
> The terminal emulator I've been using (Konsole) doesn't appear to have anything like that, AFAICT. But I'm not really married to Konsole. Anyone know of another terminal with a feature like this?

Tilix supports this. You can define a custom regex and then use the values extracted by the regex to launch an editor to load the file at the right line number.

https://gnunn1.github.io/tilix-web/manual/customlinks/

The screenshot shows a configuration that does this for gedit.

October 15, 2018
On 10/14/18 10:28 PM, Basile B. wrote:
> 
> VTE can certainly do this. It's the library many people use to embed a terminal in their app (or to make terminals, like Tilix). You can look at the API to get a better idea of what's possible https://developer.gnome.org/vte/0.48/VteTerminal.html. Click on message is certainly possible.
> 
> I use VTE in Coedit but so far the only advanced feature is that it follows the projects path and/or the editor file path dynamically. Useful but far from what you describe, which is done elsewhere.
> 
> I think that Konsole must be based on something similar to VTE (i.e a library) because the way it's integrated in Dolphin for example shows that it's not just a window that's hosted (it follows the path selected in the explorer... oh i remember where i stole the idea now...)

Cool, I didn't know about VTE. On the desktop, I'm more KDE/Qt, but apparently, it seems Qt has an equivalent: qtermwidget. Don't know whether it supports the same thing though. Will have to look into it.
October 15, 2018
On 10/14/18 10:31 PM, Gerald wrote:
> 
> Tilix supports this. You can define a custom regex and then use the values extracted by the regex to launch an editor to load the file at the right line number.
> 
> https://gnunn1.github.io/tilix-web/manual/customlinks/
> 
> The screenshot shows a configuration that does this for gedit.

Awesome! With all the terminal emulators out there, I figured I couldn't be the only one to think of this.

I'll admit, I have a very strong personal distaste for UIs that use the GNOME interface guidelines. But, this is such a useful feature, I think I'll be using it anyway when I'm coding. And heck, maybe someday I'll just whip up a term of my own :)

I've been using KDevelop as my editor lately, and it doesn't support this *quite* as nicely as I would like. But this configuration does seem to be working for me:

Regex: (.*)\(([0-9]+)\):.*
Cmd:   kdevelop -s SESSION_NAME_HERE $1:$2

Unfortunately, Tilix doesn't appear to support using envvars from the current terminal in the custom command above (if that would even be possible), so I'll have to manually change SESSION_NAME_HERE to my KDevelop session name once per session. (Or always use "curr" or something for whatever session I'm currently working in.)

Still though, this will be really nice to have working. Thanks.
October 15, 2018
On 10/15/18 2:00 AM, Nick Sabalausky (Abscissa) wrote:
> Unfortunately, Tilix doesn't appear to support using envvars from the current terminal in the custom command above (if that would even be possible), so I'll have to manually change SESSION_NAME_HERE to my KDevelop session name once per session. (Or always use "curr" or something for whatever session I'm currently working in.)

Ooohh, oohh!!! I can just use a file instead of an envvar:

kdevelop -s `cat ~/.kdev-sess` $1:$2

$ echo name-of-desired-kdevelop-session > ~/.kdev-sess
(Or better yet, wrap that in a trivial script.)