-
Notifications
You must be signed in to change notification settings - Fork 611
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
Add comments for bind commands [#809] #926
base: master
Are you sure you want to change the base?
Add comments for bind commands [#809] #926
Commits on Jul 26, 2019
-
Improve argv_to_string_alloc()
1. Fix bug in argv_to_string_alloc(), which did not increase buffer size to account for number of separators. 2. Improve coding a. Initialize buffer size to one to account for terminator, which avoids the need to later increment by one. b. Call concat_argv() directly, instead of calling argv_to_string(), which is a wrapper. 3. Add similar function argv_to_string_alloc_prefix(), which preloads string buffer with a prefix string.
Configuration menu - View commit details
-
Copy full SHA for 5088ad7 - Browse repository at this point
Copy the full SHA 5088ad7View commit details -
Ability to add comments into help view [jonas#809]
1. keys.h Add a run_request.help field, analogous to the req_info.help field. 2. options.h Add a parameter to set_option() for passing any comment text. 3. options.c a. read_option() Identify any #comment text string that may have accompanied an option command, and pass it into set_option(). The #comment text string is trimmed of any white space. b. set_option() set_option() dispatches to specific bind commands. Pass any given comment text into the option_bind_command(), and ignore comment text for the other bind commands. c. option_bind_command() Pass comment text into add_run_request(). d. read_repo_config_option() Specify the option command to use with "color", "bind", or "set" names instead of specific function names. e. set_repo_config_option() Refactor to call set_option(), the dispatcher for specific bind commands, and call with comment text pointer set to NULL, because comment text is never available from a repo configuration file. 4. prompt.c a. run_prompt_command() Call set_option() with comment text pointer set to NULL, because comment text is not parsed on a prompt line. 5. keys.c a. add_run_request() Duplicate comment text into the new run_request.help field. 6. help.c a. help_draw() Draw the run_request.help text using draw_text(), analogous to drawing req_info.help.
Configuration menu - View commit details
-
Copy full SHA for b8751cb - Browse repository at this point
Copy the full SHA b8751cbView commit details -
Draw comment text in help view in alignment
Add code to align comment text when shown in the help screen. Comment text are drawn on the right-hand side of an 'action' field. Change the calculation of field width: only key bindings with comment text will participate in calculating the field width. Consequently, key bindings with no comments but with unusually long action names are allowed to overflow the field. 1. keys.h Add a name field to struct run_request, analogous to the name field in struct req_info. 2. keys.c a. add_run_request() * Load run_request.name with a displayable version of **argv, using new function argv_to_string_alloc_prefix(). * Include run_request.flags as a string prefix. 3. help.c a. help_keys_visitor() * If run_request.help text is present, update help_state.name_width with strlen(run_request.name), so that drawing run_request.help will be aligned. * We can also do the same for req_info.help text: calculate the maximum field width only if req_info.help text is available. b. help_draw() * Analogous to drawing req_info.name as a LINE_HELP_ACTION, draw run_request.name using draw_field(), which replaces the current method of drawing **argv using draw_formatted(). We do this only if run_request.help text is present, otherwise, we draw run_request.name as free-form text. * Do the same for req_info.name. In this way, the code for drawing both types of requests are more similar.
Configuration menu - View commit details
-
Copy full SHA for ddae6be - Browse repository at this point
Copy the full SHA ddae6beView commit details -
1. help/default-test The action name field is wider causing re-alignment of help text. 2. tigrc/parse-test Comment for a key binding is now exposed as help text. 3. help/user-command-comment-test Add a new test for defining user comments for user commands.
Configuration menu - View commit details
-
Copy full SHA for 54db1af - Browse repository at this point
Copy the full SHA 54db1afView commit details -
Ensure that comment text in all keybindings is searchable
1. help.c a. help_grep() For keybinding for each run request, include any help text in the text line so that it can participate in grep operations.
Configuration menu - View commit details
-
Copy full SHA for 852192d - Browse repository at this point
Copy the full SHA 852192dView commit details -
Cache key strings calculated during help_open() so that help_draw() d…
…oes not need to recalculate them 1. help.c a. struct help Add a key field to cache key strings calculated during help_open() so that help_draw() does not need to recalculate. b. help_keys_visitor() Cache the available key string in help.key. c. help_draw(), help_grep() Use cached help.key string instead of recalculating the key string. d. help_open() Free any key strings that have been cached in the help struct to prevent memory leak during a refresh of help screen.
Configuration menu - View commit details
-
Copy full SHA for dcfe1fd - Browse repository at this point
Copy the full SHA dcfe1fdView commit details