[BACK]Return to cmd-find.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / tmux

Diff for /src/usr.bin/tmux/cmd-find.c between version 1.43 and 1.44

version 1.43, 2017/04/05 10:49:46 version 1.44, 2017/04/05 11:04:48
Line 43 
Line 43 
 static const char *cmd_find_map_table(const char *[][2], const char *);  static const char *cmd_find_map_table(const char *[][2], const char *);
   
 static int      cmd_find_get_session(struct cmd_find_state *, const char *);  static int      cmd_find_get_session(struct cmd_find_state *, const char *);
 static int      cmd_find_get_window(struct cmd_find_state *, const char *);  static int      cmd_find_get_window(struct cmd_find_state *, const char *, int);
 static int      cmd_find_get_window_with_session(struct cmd_find_state *,  static int      cmd_find_get_window_with_session(struct cmd_find_state *,
                     const char *);                      const char *);
 static int      cmd_find_get_pane(struct cmd_find_state *, const char *);  static int      cmd_find_get_pane(struct cmd_find_state *, const char *, int);
 static int      cmd_find_get_pane_with_session(struct cmd_find_state *,  static int      cmd_find_get_pane_with_session(struct cmd_find_state *,
                     const char *);                      const char *);
 static int      cmd_find_get_pane_with_window(struct cmd_find_state *,  static int      cmd_find_get_pane_with_window(struct cmd_find_state *,
Line 464 
Line 464 
   
 /* Find window from string. Fills in s, wl, w. */  /* Find window from string. Fills in s, wl, w. */
 static int  static int
 cmd_find_get_window(struct cmd_find_state *fs, const char *window)  cmd_find_get_window(struct cmd_find_state *fs, const char *window, int only)
 {  {
         log_debug("%s: %s", __func__, window);          log_debug("%s: %s", __func__, window);
   
Line 484 
Line 484 
                 return (0);                  return (0);
   
         /* Otherwise try as a session itself. */          /* Otherwise try as a session itself. */
         if (cmd_find_get_session(fs, window) == 0) {          if (!only && cmd_find_get_session(fs, window) == 0) {
                 fs->wl = fs->s->curw;                  fs->wl = fs->s->curw;
                 fs->w = fs->wl->window;                  fs->w = fs->wl->window;
                 if (~fs->flags & CMD_FIND_WINDOW_INDEX)                  if (~fs->flags & CMD_FIND_WINDOW_INDEX)
Line 651 
Line 651 
   
 /* Find pane from string. Fills in s, wl, w, wp. */  /* Find pane from string. Fills in s, wl, w, wp. */
 static int  static int
 cmd_find_get_pane(struct cmd_find_state *fs, const char *pane)  cmd_find_get_pane(struct cmd_find_state *fs, const char *pane, int only)
 {  {
         log_debug("%s: %s", __func__, pane);          log_debug("%s: %s", __func__, pane);
   
Line 675 
Line 675 
                 return (0);                  return (0);
   
         /* Otherwise try as a window itself (this will also try as session). */          /* Otherwise try as a window itself (this will also try as session). */
         if (cmd_find_get_window(fs, pane) == 0) {          if (!only && cmd_find_get_window(fs, pane, 0) == 0) {
                 fs->wp = fs->w->active;                  fs->wp = fs->w->active;
                 return (0);                  return (0);
         }          }
Line 982 
Line 982 
         struct mouse_event      *m;          struct mouse_event      *m;
         char                    *colon, *period, *copy = NULL;          char                    *colon, *period, *copy = NULL;
         const char              *session, *window, *pane;          const char              *session, *window, *pane;
           int                      window_only = 0, pane_only = 0;
   
         /* Log the arguments. */          /* Log the arguments. */
         if (target == NULL)          if (target == NULL)
Line 1066 
Line 1067 
         if (colon != NULL && period != NULL) {          if (colon != NULL && period != NULL) {
                 session = copy;                  session = copy;
                 window = colon;                  window = colon;
                   window_only = 1;
                 pane = period;                  pane = period;
                   pane_only = 1;
         } else if (colon != NULL && period == NULL) {          } else if (colon != NULL && period == NULL) {
                 session = copy;                  session = copy;
                 window = colon;                  window = colon;
                   window_only = 1;
         } else if (colon == NULL && period != NULL) {          } else if (colon == NULL && period != NULL) {
                 window = copy;                  window = copy;
                 pane = period;                  pane = period;
                   pane_only = 1;
         } else {          } else {
                 if (*copy == '$')                  if (*copy == '$')
                         session = copy;                          session = copy;
Line 1179 
Line 1184 
         /* No session. If window and pane, try them. */          /* No session. If window and pane, try them. */
         if (window != NULL && pane != NULL) {          if (window != NULL && pane != NULL) {
                 /* This will fill in session, winlink and window. */                  /* This will fill in session, winlink and window. */
                 if (cmd_find_get_window(fs, window) != 0)                  if (cmd_find_get_window(fs, window, window_only) != 0)
                         goto no_window;                          goto no_window;
                 /* This will fill in pane. */                  /* This will fill in pane. */
                 if (cmd_find_get_pane_with_window(fs, pane) != 0)                  if (cmd_find_get_pane_with_window(fs, pane) != 0)
Line 1190 
Line 1195 
         /* If just window is present, try it. */          /* If just window is present, try it. */
         if (window != NULL && pane == NULL) {          if (window != NULL && pane == NULL) {
                 /* This will fill in session, winlink and window. */                  /* This will fill in session, winlink and window. */
                 if (cmd_find_get_window(fs, window) != 0)                  if (cmd_find_get_window(fs, window, window_only) != 0)
                         goto no_window;                          goto no_window;
                 fs->wp = fs->wl->window->active;                  fs->wp = fs->wl->window->active;
                 goto found;                  goto found;
Line 1199 
Line 1204 
         /* If just pane is present, try it. */          /* If just pane is present, try it. */
         if (window == NULL && pane != NULL) {          if (window == NULL && pane != NULL) {
                 /* This will fill in session, winlink, window and pane. */                  /* This will fill in session, winlink, window and pane. */
                 if (cmd_find_get_pane(fs, pane) != 0)                  if (cmd_find_get_pane(fs, pane, pane_only) != 0)
                         goto no_pane;                          goto no_pane;
                 goto found;                  goto found;
         }          }

Legend:
Removed from v.1.43  
changed lines
  Added in v.1.44