• R/O
  • HTTP
  • SSH
  • HTTPS

提交

標籤
無標籤

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

GNU Binutils with patches for OS216


Commit MetaInfo

修訂97605e61a14518b1a0ac2a576f4f3c843743e4d5 (tree)
時間2015-07-13 23:47:06
作者Andrew Burgess <andrew.burgess@embe...>
CommiterAndrew Burgess

Log Message

gdb/tui: Add command completion to winheight command.

Share the window name completion code from the focus command with the
winheight command, providing window name completion for the winheight
command.

gdb/ChangeLog:

* tui/tui-win.c (window_name_completer): New function.
(focus_completer): Call window_name_completer. All old content
moved into window_name_completer.
(winheight_completer): New function.
(_initialize_tui_win): Rename variable. Add completer to
winheight command. Update doc string on winheight.

Change Summary

差異

--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,12 @@
1+2015-07-13 Andrew Burgess <andrew.burgess@embecosm.com>
2+
3+ * tui/tui-win.c (window_name_completer): New function.
4+ (focus_completer): Call window_name_completer. All old content
5+ moved into window_name_completer.
6+ (winheight_completer): New function.
7+ (_initialize_tui_win): Rename variable. Add completer to
8+ winheight command. Update doc string on winheight.
9+
110 2015-07-12 Sandra Loosemore <sandra@codesourcery.com>
211
312 * nios2-linux-tdep.c (_initialize_nios2_linux_tdep): Register
--- a/gdb/tui/tui-win.c
+++ b/gdb/tui/tui-win.c
@@ -354,12 +354,14 @@ tui_set_var_cmd (char *null_args, int from_tty, struct cmd_list_element *c)
354354 tui_rehighlight_all ();
355355 }
356356
357-/* Complete possible window names to focus on. TEXT is the complete text
358- entered so far, WORD is the word currently being completed. */
357+/* Generic window name completion function. Complete window name pointed
358+ to by TEXT and WORD. If INCLUDE_NEXT_PREV_P is true then the special
359+ window names 'next' and 'prev' will also be considered as possible
360+ completions of the window name. */
359361
360362 static VEC (char_ptr) *
361-focus_completer (struct cmd_list_element *ignore,
362- const char *text, const char *word)
363+window_name_completer (int include_next_prev_p,
364+ const char *text, const char *word)
363365 {
364366 VEC (const_char_ptr) *completion_name_vec = NULL;
365367 VEC (char_ptr) *matches_vec;
@@ -389,10 +391,13 @@ focus_completer (struct cmd_list_element *ignore,
389391 VEC_safe_push (const_char_ptr, completion_name_vec, CMD_NAME);
390392 }
391393
392- VEC_safe_push (const_char_ptr, completion_name_vec, "next");
393- VEC_safe_push (const_char_ptr, completion_name_vec, "prev");
394- VEC_safe_push (const_char_ptr, completion_name_vec, NULL);
394+ if (include_next_prev_p)
395+ {
396+ VEC_safe_push (const_char_ptr, completion_name_vec, "next");
397+ VEC_safe_push (const_char_ptr, completion_name_vec, "prev");
398+ }
395399
400+ VEC_safe_push (const_char_ptr, completion_name_vec, NULL);
396401 matches_vec
397402 = complete_on_enum (VEC_address (const_char_ptr, completion_name_vec),
398403 text, word);
@@ -402,6 +407,32 @@ focus_completer (struct cmd_list_element *ignore,
402407 return matches_vec;
403408 }
404409
410+/* Complete possible window names to focus on. TEXT is the complete text
411+ entered so far, WORD is the word currently being completed. */
412+
413+static VEC (char_ptr) *
414+focus_completer (struct cmd_list_element *ignore,
415+ const char *text, const char *word)
416+{
417+ return window_name_completer (1, text, word);
418+}
419+
420+/* Complete possible window names for winheight command. TEXT is the
421+ complete text entered so far, WORD is the word currently being
422+ completed. */
423+
424+static VEC (char_ptr) *
425+winheight_completer (struct cmd_list_element *ignore,
426+ const char *text, const char *word)
427+{
428+ /* The first word is the window name. That we can complete. Subsequent
429+ words can't be completed. */
430+ if (word != text)
431+ return NULL;
432+
433+ return window_name_completer (0, text, word);
434+}
435+
405436 /* Function to initialize gdb commands, for tui window
406437 manipulation. */
407438
@@ -413,7 +444,7 @@ _initialize_tui_win (void)
413444 {
414445 static struct cmd_list_element *tui_setlist;
415446 static struct cmd_list_element *tui_showlist;
416- struct cmd_list_element *focus_cmd;
447+ struct cmd_list_element *cmd;
417448
418449 /* Define the classes of commands.
419450 They will appear in the help list in the reverse of this order. */
@@ -431,8 +462,8 @@ _initialize_tui_win (void)
431462 add_com ("tabset", class_tui, tui_set_tab_width_command, _("\
432463 Set the width (in characters) of tab stops.\n\
433464 Usage: tabset <n>\n"));
434- add_com ("winheight", class_tui, tui_set_win_height_command, _("\
435-Set the height of a specified window.\n\
465+ cmd = add_com ("winheight", class_tui, tui_set_win_height_command, _("\
466+Set or modify the height of a specified window.\n\
436467 Usage: winheight <win_name> [+ | -] <#lines>\n\
437468 Window names are:\n\
438469 src : the source window\n\
@@ -440,9 +471,10 @@ cmd : the command window\n\
440471 asm : the disassembly window\n\
441472 regs : the register display\n"));
442473 add_com_alias ("wh", "winheight", class_tui, 0);
474+ set_cmd_completer (cmd, winheight_completer);
443475 add_info ("win", tui_all_windows_info,
444476 _("List of all displayed windows.\n"));
445- focus_cmd = add_com ("focus", class_tui, tui_set_focus_command, _("\
477+ cmd = add_com ("focus", class_tui, tui_set_focus_command, _("\
446478 Set focus to named window or next/prev window.\n\
447479 Usage: focus {<win> | next | prev}\n\
448480 Valid Window names are:\n\
@@ -451,7 +483,7 @@ asm : the disassembly window\n\
451483 regs : the register display\n\
452484 cmd : the command window\n"));
453485 add_com_alias ("fs", "focus", class_tui, 0);
454- set_cmd_completer (focus_cmd, focus_completer);
486+ set_cmd_completer (cmd, focus_completer);
455487 add_com ("+", class_tui, tui_scroll_forward_command, _("\
456488 Scroll window forward.\n\
457489 Usage: + [win] [n]\n"));