After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 767369 - command-bar: Fix a bug in tab autocompletion
command-bar: Fix a bug in tab autocompletion
Status: RESOLVED FIXED
Product: gnome-builder
Classification: Other
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: GNOME Builder Maintainers
GNOME Builder Maintainers
Depends on:
Blocks:
 
 
Reported: 2016-06-07 17:48 UTC by Matthew Leeds
Modified: 2016-06-11 13:25 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
command-bar: Fix a file path tab autocomplete issue (2.89 KB, patch)
2016-06-07 17:48 UTC, Matthew Leeds
none Details | Review
command-bar: Check if the completion provider fulfills its contract (1.32 KB, patch)
2016-06-07 17:48 UTC, Matthew Leeds
none Details | Review
command-bar: Fix a file path tab autocomplete issue (2.90 KB, patch)
2016-06-07 18:28 UTC, Matthew Leeds
committed Details | Review
command-bar: Check if the completion provider fulfills its contract (1.32 KB, patch)
2016-06-07 18:28 UTC, Matthew Leeds
committed Details | Review
command-bar: Check if the completion provider fulfills its contract (1.32 KB, patch)
2016-06-09 17:00 UTC, Matthew Leeds
committed Details | Review
command-bar: Check if the completion provider fulfills its contract (1.32 KB, patch)
2016-06-09 17:08 UTC, Matthew Leeds
committed Details | Review
command-bar: Fix a file path tab autocomplete issue (2.90 KB, patch)
2016-06-09 17:08 UTC, Matthew Leeds
committed Details | Review
command-bar: Fix vim mode tab autocompletion issues (2.72 KB, patch)
2016-06-10 20:39 UTC, Matthew Leeds
none Details | Review
command-bar: Fix vim mode tab autocompletion issues (2.73 KB, patch)
2016-06-10 21:02 UTC, Matthew Leeds
none Details | Review
command-bar: Fix vim mode tab autocompletion issues (2.73 KB, patch)
2016-06-10 23:56 UTC, Matthew Leeds
committed Details | Review

Description Matthew Leeds 2016-06-07 17:48:28 UTC
In the command bar, if you try to tab autocomplete, it will show 
invalid characters sometimes.
Comment 1 Matthew Leeds 2016-06-07 17:48:32 UTC
Created attachment 329319 [details] [review]
command-bar: Fix a file path tab autocomplete issue

gb_command_bar_complete expects completions returned by the
GbCommandVimProvider to include the full prefix that the user typed in,
not just the filename. Since gb_vim_complete_edit_files returns the
filename or a relative path from the working directory,
gb_command_bar_complete reads past the end of a character array. This
commit makes the completion provider return full file paths to fix this
issue.
Comment 2 Matthew Leeds 2016-06-07 17:48:36 UTC
Created attachment 329320 [details] [review]
command-bar: Check if the completion provider fulfills its contract

Emit a warning if the provided completion is not a prefix of the command
typed by the user, and don't display it as an option. Otherwise we would
read past the end of a character array.
Comment 3 Christian Hergert 2016-06-07 17:52:41 UTC
Review of attachment 329319 [details] [review]:

Looks good, just add the = NULL to the autofree then feel free to push/close.

::: plugins/command-bar/gb-vim.c
@@ +1325,3 @@
+              gchar *completed_command;
+              const gchar *descendent_name;
+              g_autofree gchar *full_path;

Always set g_autofree declarations to NULL, even if they get set immediately after declaration. (We just like to be consistent everywhere so it is easy to catch improper use).
Comment 4 Matthew Leeds 2016-06-07 18:28:35 UTC
Created attachment 329324 [details] [review]
command-bar: Fix a file path tab autocomplete issue

gb_command_bar_complete expects completions returned by the
GbCommandVimProvider to include the full prefix that the user typed in,
not just the filename. Since gb_vim_complete_edit_files returns the
filename or a relative path from the working directory,
gb_command_bar_complete reads past the end of a character array. This
commit makes the completion provider return full file paths to fix this
issue.
Comment 5 Matthew Leeds 2016-06-07 18:28:39 UTC
Created attachment 329325 [details] [review]
command-bar: Check if the completion provider fulfills its contract

Emit a warning if the provided completion is not a prefix of the command
typed by the user, and don't display it as an option. Otherwise we would
read past the end of a character array.
Comment 6 Christian Hergert 2016-06-07 19:32:27 UTC
Review of attachment 329325 [details] [review]:

LGTM
Comment 7 Christian Hergert 2016-06-07 19:36:35 UTC
Review of attachment 329324 [details] [review]:

LGTM
Comment 8 Matthew Leeds 2016-06-09 17:00:13 UTC
The following fixes have been pushed:
f927694 command-bar: Check if the completion provider fulfills its contract
08cc0c1 command-bar: Fix a file path tab autocomplete issue
Comment 9 Matthew Leeds 2016-06-09 17:00:16 UTC
Created attachment 329489 [details] [review]
command-bar: Check if the completion provider fulfills its contract

Emit a warning if the provided completion is not a prefix of the command
typed by the user, and don't display it as an option. Otherwise we would
read past the end of a character array.
Comment 10 Matthew Leeds 2016-06-09 17:08:47 UTC
The following fixes have been pushed:
f927694 command-bar: Check if the completion provider fulfills its contract
08cc0c1 command-bar: Fix a file path tab autocomplete issue
Comment 11 Matthew Leeds 2016-06-09 17:08:55 UTC
Created attachment 329490 [details] [review]
command-bar: Check if the completion provider fulfills its contract

Emit a warning if the provided completion is not a prefix of the command
typed by the user, and don't display it as an option. Otherwise we would
read past the end of a character array.
Comment 12 Matthew Leeds 2016-06-09 17:08:59 UTC
Created attachment 329491 [details] [review]
command-bar: Fix a file path tab autocomplete issue

gb_command_bar_complete expects completions returned by the
GbCommandVimProvider to include the full prefix that the user typed in,
not just the filename. Since gb_vim_complete_edit_files returns the
filename or a relative path from the working directory,
gb_command_bar_complete reads past the end of a character array. This
commit makes the completion provider return full file paths to fix this
issue.
Comment 13 Matthew Leeds 2016-06-10 20:39:27 UTC
Created attachment 329585 [details] [review]
command-bar: Fix vim mode tab autocompletion issues

gb_vim_complete_edit_files returns the completed file path as an
absolute path even when the user typed a relative path. This commit
makes the completion look like the user input even for relative paths,
which allows gb_command_bar_complete to correctly complete file paths
for the user.
Comment 14 Christian Hergert 2016-06-10 20:42:23 UTC
Review of attachment 329585 [details] [review]:

::: plugins/command-bar/gb-vim.c
@@ +1308,3 @@
+        {
+          partial_name = slash + 1;
+          prefix_dir = g_strndup (prefix, slash - prefix + 1);

Leaking prefix_dir here.
Comment 15 Matthew Leeds 2016-06-10 21:02:28 UTC
Created attachment 329589 [details] [review]
command-bar: Fix vim mode tab autocompletion issues

gb_vim_complete_edit_files returns the completed file path as an
absolute path even when the user typed a relative path. This commit
makes the completion look like the user input even for relative paths,
which allows gb_command_bar_complete to correctly complete file paths
for the user.
Comment 16 Christian Hergert 2016-06-10 21:57:35 UTC
Review of attachment 329589 [details] [review]:

::: plugins/command-bar/gb-vim.c
@@ +1296,3 @@
       const gchar *slash;
+      const gchar *partial_name;
+      g_autofree const gchar *prefix_dir;

= NULL and drop the const
Comment 17 Matthew Leeds 2016-06-10 23:56:44 UTC
Created attachment 329593 [details] [review]
command-bar: Fix vim mode tab autocompletion issues

gb_vim_complete_edit_files returns the completed file path as an
absolute path even when the user typed a relative path. This commit
makes the completion look like the user input even for relative paths,
which allows gb_command_bar_complete to correctly complete file paths
for the user.
Comment 18 Christian Hergert 2016-06-11 01:11:18 UTC
Review of attachment 329593 [details] [review]:

LGTM
Comment 19 Matthew Leeds 2016-06-11 13:25:03 UTC
Attachment 329593 [details] pushed as 83116ae - command-bar: Fix vim mode tab autocompletion issues