~ubuntu-branches/debian/sid/neovim/sid

« back to all changes in this revision

Viewing changes to src/nvim/window.c

  • Committer: Package Import Robot
  • Author(s): James McCoy
  • Date: 2016-04-18 21:42:19 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20160418214219-1e6d4o1fwqarzk46
Tags: 0.1.3-1
* New upstream release.  (Closes: #820562)
* debian/control:
  + Remove unnecessary luarocks Build-Depends
  + Add libkvm-dev Build-Depends for kfreebsd-*
  + Add python(3)-neovim to Recommends.  (Closes: #812737)
  + Declare compiance with policy 3.9.8, no changes needed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
248
248
      /* First create a new tab with the window, then go back to
249
249
       * the old tab and close the window there. */
250
250
      wp = curwin;
251
 
      if (win_new_tabpage((int)Prenum) == OK
 
251
      if (win_new_tabpage((int)Prenum, NULL) == OK
252
252
          && valid_tabpage(oldtab)) {
253
253
        newtab = curtab;
254
254
        goto_tabpage_tp(oldtab, TRUE, TRUE);
2952
2952
  xfree(tp);
2953
2953
}
2954
2954
 
2955
 
/*
2956
 
 * Create a new Tab page with one window.
2957
 
 * It will edit the current buffer, like after ":split".
2958
 
 * When "after" is 0 put it just after the current Tab page.
2959
 
 * Otherwise put it just before tab page "after".
2960
 
 * Return FAIL or OK.
2961
 
 */
2962
 
int win_new_tabpage(int after)
 
2955
/// Create a new tabpage with one window.
 
2956
///
 
2957
/// It will edit the current buffer, like after :split.
 
2958
///
 
2959
/// @param after Put new tabpage after tabpage "after", or after the current
 
2960
///              tabpage in case of 0.
 
2961
/// @param filename Will be passed to apply_autocmds().
 
2962
/// @return Was the new tabpage created successfully? FAIL or OK.
 
2963
int win_new_tabpage(int after, char_u *filename)
2963
2964
{
2964
2965
  tabpage_T   *tp = curtab;
2965
2966
  tabpage_T   *newtp;
2999
3000
    newtp->tp_topframe = topframe;
3000
3001
    last_status(FALSE);
3001
3002
 
3002
 
 
3003
3003
    redraw_all_later(CLEAR);
3004
 
    apply_autocmds(EVENT_WINENTER, NULL, NULL, FALSE, curbuf);
3005
 
    apply_autocmds(EVENT_TABENTER, NULL, NULL, FALSE, curbuf);
 
3004
 
 
3005
    apply_autocmds(EVENT_TABNEW, filename, filename, false, curbuf);
 
3006
    apply_autocmds(EVENT_WINENTER, NULL, NULL, false, curbuf);
 
3007
    apply_autocmds(EVENT_TABENTER, NULL, NULL, false, curbuf);
 
3008
 
3006
3009
    return OK;
3007
3010
  }
3008
3011
 
3023
3026
  if (n != 0) {
3024
3027
    cmdmod.tab = 0;         /* reset it to avoid doing it twice */
3025
3028
    postponed_split_tab = 0;
3026
 
    return win_new_tabpage(n);
 
3029
    return win_new_tabpage(n, NULL);
3027
3030
  }
3028
3031
  return FAIL;
3029
3032
}
3047
3050
   */
3048
3051
  block_autocmds();
3049
3052
 
3050
 
  for (todo = count - 1; todo > 0; --todo)
3051
 
    if (win_new_tabpage(0) == FAIL)
 
3053
  for (todo = count - 1; todo > 0; --todo) {
 
3054
    if (win_new_tabpage(0, NULL) == FAIL) {
3052
3055
      break;
 
3056
    }
 
3057
  }
3053
3058
 
3054
3059
  unblock_autocmds();
3055
3060
 
4575
4580
  }
4576
4581
  assert(fr);
4577
4582
 
4578
 
  if (room < offset)            /* Not enough room */
4579
 
    offset = room;              /* Move as far as we can */
4580
 
  if (offset <= 0)              /* No room at all, quit. */
 
4583
  // Not enough room
 
4584
  if (room < offset) {
 
4585
    offset = room;  // Move as far as we can
 
4586
  }
 
4587
 
 
4588
  // No room at all, quit.
 
4589
  if (offset <= 0) {
4581
4590
    return;
 
4591
  }
 
4592
 
 
4593
  if (fr == NULL) {
 
4594
    return;  // Safety check, should not happen.
 
4595
  }
4582
4596
 
4583
4597
  /* grow frame fr by offset lines */
4584
4598
  frame_new_width(fr, fr->fr_width + offset, left, FALSE);
4610
4624
 
4611
4625
#define FRACTION_MULT   16384L
4612
4626
 
4613
 
/*
4614
 
 * Set wp->w_fraction for the current w_wrow and w_height.
4615
 
 */
4616
 
static void set_fraction(win_T *wp)
 
4627
// Set wp->w_fraction for the current w_wrow and w_height.
 
4628
void set_fraction(win_T *wp)
4617
4629
{
4618
4630
  wp->w_fraction = ((long)wp->w_wrow * FRACTION_MULT + wp->w_height / 2)
4619
4631
                   / (long)wp->w_height;
5342
5354
}
5343
5355
 
5344
5356
 
5345
 
/*
5346
 
 * Add match to the match list of window 'wp'.  The pattern 'pat' will be
5347
 
 * highlighted with the group 'grp' with priority 'prio'.
5348
 
 * Optionally, a desired ID 'id' can be specified (greater than or equal to 1).
5349
 
 * If no particular ID is desired, -1 must be specified for 'id'.
5350
 
 * Return ID of added match, -1 on failure.
5351
 
 */
5352
 
int match_add(win_T *wp, char_u *grp, char_u *pat, int prio, int id, list_T *pos_list)
 
5357
// Add match to the match list of window 'wp'.  The pattern 'pat' will be
 
5358
// highlighted with the group 'grp' with priority 'prio'.
 
5359
// Optionally, a desired ID 'id' can be specified (greater than or equal to 1).
 
5360
// If no particular ID is desired, -1 must be specified for 'id'.
 
5361
// Return ID of added match, -1 on failure.
 
5362
int match_add(win_T *wp, char_u *grp, char_u *pat,
 
5363
              int prio, int id, list_T *pos_list,
 
5364
              char_u *conceal_char)
5353
5365
{
5354
5366
  matchitem_T *cur;
5355
5367
  matchitem_T *prev;
5405
5417
  m->match.regprog = regprog;
5406
5418
  m->match.rmm_ic = FALSE;
5407
5419
  m->match.rmm_maxcol = 0;
 
5420
  m->conceal_char = 0;
 
5421
  if (conceal_char != NULL) {
 
5422
    m->conceal_char = (*mb_ptr2char)(conceal_char);
 
5423
  }
5408
5424
 
5409
5425
  // Set up position matches
5410
5426
  if (pos_list != NULL)