Fixed handling of command line arguments within the shell command for the VTE to enable use of shells as login shells.

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@1464 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Enrico Tröger 2007-04-19 13:44:42 +00:00
parent b954dc8245
commit e0985eac5a
3 changed files with 32 additions and 6 deletions

View File

@ -1,3 +1,10 @@
2007-04-19 Enrico Tröger <enrico.troeger@uvena.de>
* doc/geany.docbook, src/vte.c:
Fixed handling of command line arguments within the shell command for
the VTE to enable use of shells as login shells.
2007-04-18 Nick Treleaven <nick.treleaven@btinternet.com> 2007-04-18 Nick Treleaven <nick.treleaven@btinternet.com>
* doc/geany.docbook: * doc/geany.docbook:

View File

@ -394,6 +394,12 @@
pressing the middle mouse button in the VTE (on 2-button mice, pressing the middle mouse button in the VTE (on 2-button mice,
the middle button can often be simulated by pressing both mouse buttons together). the middle button can often be simulated by pressing both mouse buttons together).
</para> </para>
<para>
In the preferences dialog you can specify a shell which should be started in the
VTE. To make the specified shell a login shell just use the appropriate command
line options for the shell. These options should be found in the manual page of
the shell. For zsh and bash you can use the argument <literal>--login</literal>.
</para>
<note> <note>
<para><application>Geany</application> tries to load <filename>libvte.so</filename>. <para><application>Geany</application> tries to load <filename>libvte.so</filename>.
If this fails, it tries to load <filename>libvte.so.4</filename>. If this If this fails, it tries to load <filename>libvte.so.4</filename>. If this

View File

@ -233,8 +233,11 @@ static gboolean vte_keypress(GtkWidget *widget, GdkEventKey *event, gpointer dat
{ {
vte_get_working_directory(); // try to keep the working directory when restarting the VTE vte_get_working_directory(); // try to keep the working directory when restarting the VTE
kill(pid, SIGINT); if (pid > 0)
pid = 0; {
kill(pid, SIGINT);
pid = 0;
}
vf->vte_terminal_reset(VTE_TERMINAL(widget), TRUE, TRUE); vf->vte_terminal_reset(VTE_TERMINAL(widget), TRUE, TRUE);
vte_start(widget); vte_start(widget);
@ -249,11 +252,21 @@ static void vte_start(GtkWidget *widget)
{ {
VteTerminal *vte = VTE_TERMINAL(widget); VteTerminal *vte = VTE_TERMINAL(widget);
gchar **env; gchar **env;
gchar **argv;
env = vte_get_child_environment(); // split the shell command line, so arguments will work too
pid = vf->vte_terminal_fork_command(VTE_TERMINAL(vte), vc->shell, NULL, env, argv = g_strsplit(vc->shell, " ", -1);
if (argv != NULL)
{
env = vte_get_child_environment();
pid = vf->vte_terminal_fork_command(VTE_TERMINAL(vte), argv[0], argv, env,
vte_info.dir, TRUE, TRUE, TRUE); vte_info.dir, TRUE, TRUE, TRUE);
g_strfreev(env); g_strfreev(env);
g_strfreev(argv);
}
else
pid = 0; // use 0 as invalid pid
} }
@ -405,7 +418,7 @@ const gchar* vte_get_working_directory()
gchar *cwd; gchar *cwd;
gint length; gint length;
if (pid >= 0) if (pid > 0)
{ {
file = g_strdup_printf("/proc/%d/cwd", pid); file = g_strdup_printf("/proc/%d/cwd", pid);
length = readlink(file, buffer, sizeof (buffer)); length = readlink(file, buffer, sizeof (buffer));