Repository navigation
Refactor name check and title update so works with custom prompt #584
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
Changes from all commits
7dede40
ff8d6f8
df642e9
eab3914
ed67155
446f71f
c851552
3a9ebab
eaa406a
56d6263
f0fb321
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,6 +28,7 @@ namespace Terminal { | |
| internal const string DEFAULT_LABEL = _("Terminal"); | ||
| public Terminal.Application app; | ||
| public string terminal_id; | ||
| public string current_working_directory { get; private set; default = "";} | ||
| static int terminal_id_counter = 0; | ||
| private bool init_complete; | ||
| public bool resized {get; set;} | ||
|
|
@@ -123,6 +124,8 @@ namespace Terminal { | |
|
|
||
| private double total_delta_y = 0.0; | ||
|
|
||
| public signal void cwd_changed (); | ||
|
|
||
| public TerminalWidget (MainWindow parent_window) { | ||
| pointer_autohide = true; | ||
|
|
||
|
|
@@ -223,6 +226,8 @@ namespace Terminal { | |
| resized = true; | ||
| }); | ||
|
|
||
| contents_changed.connect (check_cwd_changed); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The only thing that still bother me a little bit, is that this is also triggered for foreground processes. Guarding it with a Anyway it probably doesn't matter so much, I didn't see any performance differences on my machine.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. One solution would be to unregistered the callback when a foreground process is running and re-register it on
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, if foreground processes cannot change the cwd then this check is unnecessary. But I doubt whether the extra complexity of code is worth the (undetectable) performance gain. |
||
|
|
||
| child_exited.connect (on_child_exited); | ||
|
|
||
| /* target entries specify what kind of data the terminal widget accepts */ | ||
|
|
@@ -377,6 +382,8 @@ namespace Terminal { | |
| } catch (Error e) { | ||
| warning (e.message); | ||
| } | ||
|
|
||
| check_cwd_changed (); | ||
| } | ||
|
|
||
| public void run_program (string program_string, string? working_directory) { | ||
|
|
@@ -609,5 +616,13 @@ namespace Terminal { | |
| reset (true, true); | ||
| active_shell (old_loc); | ||
| } | ||
|
|
||
| private void check_cwd_changed () { | ||
| var cwd = get_shell_location (); | ||
| if (cwd != current_working_directory) { | ||
| current_working_directory = cwd; | ||
| cwd_changed (); | ||
| } | ||
| } | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codestyle